i want make a shop when you have 50$ you can add speed but it's don't work
local player = script.Parent.Parent.Parent.Parent.Parent local Money = player.Stats.Points function buy() if Money.Value >= 10 then Money.Value = Money.Value - 10 game.Workspace:FindFirstChild("Humanoid").WalkSpeed = 50 end end script.Parent.MouseButton1Down:connect(buy)
I assume this is a script inside a gui. If so there are a few more efficient ways you can do this. As well as a few errors you made.
local player = game.Players.LocalPlayer --Much easier way to get the player rather than a bunch of Parents local Money = player.Stats.Points function buy() if Money.Value >= 10 then Money.Value = Money.Value - 10 player.Character.Humanoid.WalkSpeed = 50 --What you were trying to do was find a Humanoid specifically in the Workspace. You need to access the player's humanoid through the localPlayer.Character end end script.Parent.MouseButton1Down:connect(buy)
And make sure that the script is a LocalScript
or you won't be able to access any of this.
Hope this helped!