P = game.Players.LocalPlayer
while true do
wait()
if P.leaderstats.Wind.Value >= 100 <= 500
then
script.Parent.Parent.Character.Humanoid.WalkSpeed = 20
elseif
P.leaderstats.Wind.Value >= 501 <= 1000
then
script.Parent.Parent.Character.Humanoid.Walkspeed = 30
elseif
P.leaderstats.Wind.Value >= 1001 <= 5000
then
script.Parent.Parent.Character.Humanoid.Walkspeed = 40
elseif
P.leaderstats.Wind.Value >= 5001 <= 25000
then
script.Parent.Parent.Character.Humanoid.Walkspeed = 50
end
end
✓ ANSWER ACCEPTED
Why won't my Sword speed up if stat is between # and #?
1 answer
✓ Accepted answer
You're conditional syntax is incorrect. What you're trying to do is check if a value is between 2 numbers, but the wording isn't correct. The correct syntax is this: if (Value >= Min and Value <= Max) then. So for your first conditional, I would reword it to this:
if P.leaderstats.Wind.Value >= 100 and P.leaderstats.Wind.Value <= 500 then
Also, it would be much simpler to store the Wind value to a variable, so that way you need to do less typing, like so:
local Wind = P.leaderstats.Wind.Value
if Wind >= 100 and Wind <= 500 then
See how much neater that is?
Here's the full fixed code:
local P = game.Players.LocalPlayer
local Humanoid = script.Parent.Parent.Character.Humanoid
while true do
local Wind = P.leaderstats.Wind.Value
if Wind >= 100 and Wind <= 500 then
Humanoid.WalkSpeed = 20
elseif Wind >= 501 and Wind <= 1000 then
Humanoid.Walkspeed = 30
elseif Wind >= 1001 and Wind <= 5000 then
Humanoid.Walkspeed = 40
elseif Wind >= 5001 and Wind <= 25000 then
Humanoid.Walkspeed = 50
end
wait()
end
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Is this a Script or a LocalScript? Where is this script located in the hierarchy?
ReplicatedStorage.WindSword.Script and its a Script.