Script not working, but no errors

I have a script, which makes a gui visible to all clients if both int values are equal to 1. It isnt working for some reason, and there are no errors in the output.

Server script:

if val.Value == 1 and val1.Value == 1 then
GG:FireAllClients()
else
GSG:FireAllClients()
end

Local script:

GG.OnClientEvent:Connect(function()

golden.Button.Visible = true
end)

GSG.OnClientEvent:Connect(function()

golden.Button.Visible = false
end)

can you put a print?

if val.Value == 1 and val1.Value == 1 then
print("True")
GG:FireAllClients()
else
print("False")
GSG:FireAllClients()
end
1 Like

Can you tell us where the scripts are located?

script 1: server script service
script 2: starter gui

I assume the problem here is that the script is checking if val and val1’s value is equal to 1, but it’s checking only when the script is started. So, maybe add like a BindableEvent when which you’ll fire when the value of any one of them changes.

An example of the server script:

local bindable = Instance.new("BindableEvent")

val.Changed:Connect(function()
    bindable:Fire()
end)

val1.Changed:Connect(function()
    bindable:Fire()
end)

bindable.Event:Connect(function()
    if val.Value == 1 and val1.Value == 1 then
        GG:FireAllClients()
    else
        GSG:FireAllClients()
    end
end)

Not sure if this would work though, but a try is at least worth it.