Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My Shop don't working ?

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)

1 comment

0

Your grammar don't working either huh?

1 answer

✓ Accepted answer

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!

1 comment

0

Thank's

This discussion is preserved as it was. New answers, comments, and votes are closed.