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

Gui Value Will Not Change When Clicked?

Asked by
sammiya1 134
8 years ago
01local Value = script.Parent.ClickValue
02local Button = script.Parent
03local Player = game.Players.LocalPlayer --get the local player
04local Mouse = Player:GetMouse() --get the mouse
05 
06function ChangeValue()
07Mouse.Button1Down:connect(function()
08Value.Value = 1
09end)
10end
11Mouse.Button1Down:connect(ChangeValue)

The problem is when i click the button it does not change the value at all to 1. Not sure what i have done wrong here.

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago
1local Value = script.Parent.ClickValue
2local Button = script.Parent
3local Player = game.Players.LocalPlayer --get the local player
4local Mouse = Player:GetMouse() --get the mouse
5 
6function ChangeValue()
7Value.Value = 1
8end
9Mouse.Button1Down:connect(ChangeValue)

You've already told the code that when you click it, it should change it now :). You can check for errors by opening the output in the studio, it helps me a lot when finding errors :3

Ad

Answer this question