Scritping Error Help

Hey I’ve been having a problem with my script. It’s a simple + 1 speed every second script but I can’t quite figure out why it’s not working. I’m not doing this for a full time thing but I just want to learn about it.

The 15th line was fully loaded.
local distance = (start_pos - Player.Character.Head.CFrame.Position).Magnitude Magnitute is at the end.

So that is my script. If you guys can find any errors why it isn’t working help would be greatly appreciated. I’ve already asked the DevForum for things related to this but now I’m going straight for the topic.

Speed isn’t defined anywhere in the code, which is why it’s throwing an error.

It seems like Speed isn’t defined, you might want to try this instead

if distance > 1 then
Player.Character.Humanoid.Walkspeed = 1
Player.Character.Humanoid.Walkspeed = Player.Character.Humanoid.Walkspeed + 1
end

Would you know how to get the speed from a different part of the script?
Basic Leaderstat

You could read that value from the client directly:

local Speed = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Speed")
print(Speed.Value)

Do note that making changes to its value client-sided will not replicate to the server, so RemoteEvents could come in handy here.


This is what I have so far. Yet the speed doesn’t go up and the speed doesn’t default to 1.