Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need to make a walk speed change script that changes the walkspeed as the number of wins change?

Asked by 4 years ago
Edited 4 years ago

I have been trying to make this script but I just can't.The walkspeed does not change. Please explain and show me the script.

0
Answering your question earlier about making a top speed, just set a variable in the local script and put in that variable what you want the top speed to be, then after you do that, put in the Event an if statement that checks to see if the humanoid walk speed is at max or not. If it's not, then increase the humanoid walk speed. If it is, then don't increase it. torchmaster101 92 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

I am going to assume you have already made a DataStore that gives each player their "Wins". But if you didn't, first type this into a server script (It's not a DataStore, just something that shows a players wins, basically it won't save the players wins):

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local wins = Instance.new("IntValue")
    wins.Name = "Wins"
    wins.Parent = leaderstats
end)

After you are done with that, insert a LOCAL script into StarterPlayerScripts. You should find it under StarterPlayer. After you insert that, do this, assuming each player is going to get one win at a time:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local wins = player.leaderstats.Wins -- Change Wins to whatever you named the IntValue
local value = 10 -- Put whatever number you want

wins.Changed:Connect(function()
    humanoid.WalkSpeed = humanoid.WalkSpeed + value --Or multiply, depending on how intense you want it to be
end)

This is a very simple way to do it. How you reward players' a win is up to you, but the local script should be able to detect that the player gained a win. If you're looking for something a bit more complex than this, let me know.

0
Thank you so much. Can you also tell me how to make a top speed so that it does not go above it iwasinevitib1e 3 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You can use loop to set the walkspeed of the player equal to their wins value, here is the example! Must be a local script

local plr = game.Players.LocalPlayer

while wait() do
       local char = plr.Character or plr.CharacterAdded:Wait()
       char.Humanoid.WalkSpeed = (plr.leaderstats.Wins.Value) + 16 -- If player wins is 0, the game will still set the player to their normal speed!
end

You can get more resource here :

Goodluck!

( If the link didnt showing up, try this : http://developer.roblox.com/en-us/articles/Loops )

Answer this question