For context when i press a button in starter gui
01 | local function onActivated() |
02 | if not debounce then |
03 | debounce = true |
04 |
05 | script.Parent.Parent.Sound:Play() |
06 |
07 |
08 | local num = math.random( 1 , 4 ) |
09 |
10 | -- below this actually works |
11 | if num = = 4 then |
12 | workspace.Row 1. Value = 4 |
13 | end |
14 |
15 |
16 | debounce = false |
17 | end |
18 | end |
19 | 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.
1 | script.Parent:GetPropertyChangedSignal( "Value" ):Connect( function () |
2 | print (script.Parent.Value) |
3 | 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)
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 |
3 | local UrEventHere = ReplicatedStorage.UrEvenHere |
4 |
5 | UrEventHere.OnServerEvent:Connect( function (player, value) |
6 | value.Value = value.Value + 1 |
7 | end ) |
Local Script(ur localcsrcipt)
01 | local function onActivated() |
02 | if not debounce then |
03 | debounce = true |
04 |
05 | script.Parent.Parent.Sound:Play() |
06 |
07 |
08 | local num = math.random( 1 , 4 ) |
09 |
10 | -- below this actually works |
11 | if num = = 4 then |
12 | event:FireServer(value) |
13 | end |
14 |
15 |
16 | debounce = false |
17 | end |
18 | end |
19 | imageButton.Activated:Connect(onActivated) |
All values(IntValues, StringValues, etc) have a .Changed event
1 | script.Parent.Changed:Connect( function (NewValue) |
2 | print (NewValue) |
3 | end ) |
'NewValue' is the value that the IntValue changes into