Well I tried a lot of time to find out how to do it but I can't really understand can someone help me?
The script: local Player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed + 1
Player.leaderstats.OOF.Value = Player.leaderstats.OOF.Value + 1
game.Workspace.Sound:Play()
script.Parent:Destroy()
end)
I think you missed out this line of code
1 | script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed + 1 |
So this finishing code should be
1 | local Player = game.Players.LocalPlayer script.Parent.MouseButton 1 Click:connect( function () script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed + 1 Player.leaderstats.OOF.Value = Player.leaderstats.OOF.Value + 1 game.Workspace.Sound:Play() script.Parent:Destroy() end ) |
Hope this helps..
While xviperlink's code works, it can be cleaned up a little. I presume that script.Parent.Parent.Parent.Parent is the player, so just use that variable, also,
PLEASE INDENT YOUR CODE!
So a cleaner local script might look something like this:
1 | local char = game.Players.LocalPlayer.Character |
2 | local hum = char:FindFirstChild( "" Humanoid") |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
4 | if hum then --check if the humanoid exists |
5 | hum.WalkSpeed = hum.WalkSpeed + 1 |
6 | end |
7 | end ) |