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
local Value = script.Parent.ClickValue
local Button = script.Parent
local Player = game.Players.LocalPlayer --get the local player
local Mouse = Player:GetMouse() --get the mouse

function ChangeValue()
Mouse.Button1Down:connect(function()
Value.Value = 1
end)
end
Mouse.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
local Value = script.Parent.ClickValue
local Button = script.Parent
local Player = game.Players.LocalPlayer --get the local player
local Mouse = Player:GetMouse() --get the mouse

function ChangeValue()
Value.Value = 1
end
Mouse.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