This is a shop that makes your walkspeed 20 when you buy it (it is a GUI).
player = script.Parent.Parent.Parent.Parent.Parent coins = player.leaderstats.Coins price = 50 h = game.Workspace:FindFirstChild("Humanoid") function buy() if coins.Value >= price then coins.Value = coins.Value - price h.Walkspeed = 20 else print 'Player has not enough money to buy!' end end script.Parent.MouseButton1Down:connect(buy)
player = script.Parent.Parent.Parent.Parent.Parent coins = player.leaderstats.Coins price = 50 h = player.Character.Humanoid -- Fixed this part for you. function buy() if coins.Value >= price then coins.Value = coins.Value - price h.WalkSpeed = 20 -- Fixed it to have a capital s! else print 'Player has not enough money to buy!' end end script.Parent.MouseButton1Down:connect(buy)
If you simply use FindFirstChild() You may end up with someone else's humanoid, though the error could be that there are no player Humanoids in the Workspace. I'm not sure if there are any other problems.