I think the good way is to make a value and through the script make a :GetPropertyChangedSignal() in this way you will get when its value changes and the following conditionals…
From docs:
local part = Instance.new("Part")
-- Save the current state
local currentColor = part.BrickColor
local function onBrickColorChanged()
local newColor = part.BrickColor
print("Color changed from " .. currentColor.Name .. " to " .. newColor.Name)
currentColor = newColor
end
part:GetPropertyChangedSignal("BrickColor"):Connect(onBrickColorChanged)
-- Make some changes
part.BrickColor = BrickColor.new("Really red")
part.BrickColor = BrickColor.new("Really blue")
You must do it from the server script with the ‘FireEvent’, what you need is that when you click that happens and it is reflected in the server, right? (for all)
local runService = game:GetService("RunService")
-- Detect if change function
local function detectTextChanged(text, textValueOption)
runService:BindToRenderStep('CheckValue', 1, function()
if text ~= textValueOption then
-- do something
warn('Is not equal')
end
if text == textValueOption then
-- do something
warn('is equal')
end
end)
end
-- calling function:
local myText = "Hello"
detectTextChanged(myText, 'Hello') -- arguments here
-- I've thought of something like that, I'm not sure if it's what you need to do