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

Why does my button when clicked not register as event?

For some reason, one of the simplest things isn't working. I am trying to make a button that when you click it, it subtracts a currency found in a GUI (Not advanced enough to make leaderboard cash, if you can help with this please tell me how.) However, when I click the button it does nothing! Even crazier, the button updates nothing at all, if I press it, it won't even register it as a click. Here is my the code:

script.Parent.MouseButton1Down:Connect(function() game.StarterGui.Money.TextLabel.Number.Value = game.StarterGui.Money.TextLabel.Number.Value - 10 end)

3 comments

0

did you try printing something whenever the button is clicked

0

Kinda, I did other tests (this is how i know it wasn't the code after clicking the button that was wrong)

0

Thank you so much RaforawesomeAlt! This is the first time I have used this website. PS: You gave me motivation!

1 answer

✓ Accepted answer

You're modifying the StarterGui. Changes in StarterGui apply when the player respawns and the gui is next cloned to them. you want to modify Player.PlayerGui instead, with something like game.Players.LocalPlayer.Money.TextLabel.Number.Value = "something" (assuming this is a LocalScript, like all gui scripts should be).

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