For context when i press a button in starter gui
local function onActivated() if not debounce then debounce = true script.Parent.Parent.Sound:Play() local num = math.random(1, 4) -- below this actually works if num == 4 then workspace.Row1.Value = 4 end debounce = false end end imageButton.Activated:Connect(onActivated)
This actually works as when i press it and the num is 4 then it will change the value to 4 but i cant detect if it changes to 4, ive tried.
script.Parent:GetPropertyChangedSignal("Value"):Connect(function() print(script.Parent.Value) end)
thats what ive tried and i dont see anything wrong with it?
CLIENT
You are changing it on client side for sure just use RemoteEvent :) bc it changes in client for the client its 4 but in the server its not.
Script(Inside ServerScriptService)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local UrEventHere = ReplicatedStorage.UrEvenHere UrEventHere.OnServerEvent:Connect(function(player, value) value.Value = value.Value + 1 end)
Local Script(ur localcsrcipt)
local function onActivated() if not debounce then debounce = true script.Parent.Parent.Sound:Play() local num = math.random(1, 4) -- below this actually works if num == 4 then event:FireServer(value) end debounce = false end end imageButton.Activated:Connect(onActivated)
All values(IntValues, StringValues, etc) have a .Changed event
script.Parent.Changed:Connect(function(NewValue) print(NewValue) end)
'NewValue' is the value that the IntValue changes into