I'm trying to make a vanilla KitPvP server, and I want to make a kit that gives you normal walking speed, but when you are sprinting, you have a speed boost. Is that possible? If so, then how?
1 Answer
First, add an objective to keep track of whether players are sprinting:
/scoreboard objectives add IsSprinting stat.sprintOneCm
On a clock, give all players with a score in that objective of at least 1 the speed effect:
/effect @a[score_IsSprinting_min=1] speed 1 2
Then, also on the same clock, set the score to 0 for everyone so that the speed boost stops being applied when a player stops sprinting:
/scoreboard players set @a IsSprinting 0
-
Awww, Colorfusion, you steal all the positions for my answers :D Commented Jun 14, 2016 at 17:11
-
1.13 syntax:
minecraft.custom:minecraft.sprint_one_cm
instead ofstat.sprint_one_cm
and the middle command becomes/effect give @a[scores={isSprinting=1..}] speed 1 2
– ppperyCommented Aug 20, 2018 at 22:22