Is it a bug or what? I printed out the type and it all returned number, not sure why it happened
local function useAnger(player)
local startTime = tick()
local hum = player.Character.Humanoid
local WalkSpeed = player.Character.Humanoid.WalkSpeed
local maxSpeed = 20+baseWalkSpeed+player.Stats.maximumSpeed.Value*3
local addSpeed = 3+player.Stats.additiveSpeed.Value*additiveSpeedMultiplier
print(type(addSpeed),type(maxSpeed),type(WalkSpeed))-->number, number, number
local function addSpeed()
for i=WalkSpeed, maxSpeed, addSpeed do
hum.WalkSpeed = i
wait(.05)
end
hum.WalkSpeed = maxSpeed
end
repeat
RS.Heartbeat:Wait()
addSpeed()
until tick() - startTime > BaseAngerTime
end
type(arg) returns the data type of the arg you supplied to it. In your example, WalkSpeed, maxSpeed, and addSpeed all seem to be numbers, so the script is functioning as it should.
Oh, okay, I see now. I’m not quite sure exactly what is causing the problem here, but it could be the scopes. Try making WalkSpeed, maxSpeed, and addSpeed variables not local (remove local before the variable). Or, if you don’t want to do that (I probably wouldn’t), then rearrange your code to look something like this:
local function useAnger(player)
local startTime = tick()
local hum = player.Character.Humanoid
local WalkSpeed = player.Character.Humanoid.WalkSpeed
local maxSpeed = 20+baseWalkSpeed+player.Stats.maximumSpeed.Value*3
local addSpeed = 3+player.Stats.additiveSpeed.Value*additiveSpeedMultiplier
print(type(addSpeed),type(maxSpeed),type(WalkSpeed))-->number, number, number
repeat
RS.Heartbeat:Wait()
for i=WalkSpeed, maxSpeed, addSpeed do
hum.WalkSpeed = i
wait(.05)
end
hum.WalkSpeed = maxSpeed
until tick() - startTime > BaseAngerTime
end
Let me know what you get
Edit: AMD_chan is correct, and you should follow what he says. Using my version of the code would also fix this issue, and so would renaming the function.
In your loop, addSpeed is a function. When you do local function addSpeed(), it implicitly creates the addSpeed variable within its scope. Simply renaming the function should fix the issue.