Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to make a GUI Button that can change a value?

Asked by 9 years ago

In my game, I have a screen GUI with a frame, TextButton.

How would I make it that when the player presses the screen GUI, it changes a value?

Thank you!

3 answers

Log in to vote
1
Answered by
RoboFrog 400 Moderation Voter
9 years ago

This will need to be in a script inside of the button. You can modify the script.Parent path as needed if your script is elsewhere.

script.Parent.MouseButton1Click:connect(function()
    game.Workspace.ExampleValue.Value = 1 -- replace with needed path
end)
Ad
Log in to vote
0
Answered by 9 years ago

Scripting Helpers is not a request site

But I can give you some help

local textButton = -- TextButton location here.   Or just script.Parent if the script is inside of the button
textButton.MouseButton1Down:connect(function() -- Connect the function
    --Here you just have the value change, example:
game.Workspace.NumberOfClicks = 19
end

Of course you would add a lot more lines to fit your liking, but you get the point.

Log in to vote
0
Answered by 9 years ago
script.Parent.MouseButton1Click:connect(function()
    game.Workspace.TheValue.Value = 0 -- Change "0" to what you want the value to equal
end)

Answer this question