You have to change their WalkSpeed in the Humanoid.
You can achieve this by doing this:
local Player = game.Players.PlayerYouIndex
-- Check if they have a Character
if Player.Character then
-- Get the humanoid and set the walkspeed
Player.Character.Humanoid.WalkSpeed = 50
end
If you want to do that, it would be best to use either PlayersService:GetPlayers() or use FireServer and OnServerEvent /InvokeServer and OnServerInvoke on RemoteEvents/RemoteFunctions respectively, which have the player that the event was fired from as the first parameter.
Specify every once in a while. What are the criteria that the player has to meet that their WalkSpeed should be changed?
This is just an example code you can fit to your script (as posted above)
local function ChangeWalkSpeed(Player, NewWalkSpeed)
if Player and Player.Character then
if Player.Character:FindFirstChildWhichIsA("Humanoid") then
Player.Character:FindFirstChildWhichIsA("Humanoid").WalkSpeed = NewWalkSpeed
end
end
end
Why not hold the Humanoid in a variable to prevent a double look-up? Seems pointless to write out the find statement twice over.
local function ChangeWalkSpeed(Player, NewWalkSpeed)
if Player and Player.Character then
local Humanoid = Player.Character:FindFirstChildWhichIsA("Humanoid")
if Humanoid then
Humanoid.WalkSpeed = NewWalkSpeed
end
end
end
[Solved] How can you make the walk speed increase multiple times when you touch it? For example, my current Walk speed is 16 but I add 10 to that when the player touches a part and when they touch it again it will make it go up 10 more. So, if I add 10 to 16 it will be 26 but then I add 10 again when they touch the part again and it becomes 36. Nevermind, My question has been solved!