Alternative to RemoteEvent?

Hello!

I was wondering if there was a good alternative to RemoteEvent as I can’t seem to get it to work. I tried making a value, setting it to 2 when a door was opened on a server script, and then on a local script, I typed this:

As much as I know it doesn’t work, I would like to know why, because I really don’t understand why it wouldn’t work.
My server script:

(I am 100% aware that this code is really messy, and I am a beginner to this)

Thank you for any help!

:slight_smile:

Edit: The only bit that doesn’t work is the GUI in the localscript. Everything else is fine :slight_smile:

Can you provide your whole code? It does not look like you used .OnClientEvent or .OnServerEvent
or even :FireServer or :FireClient

That is my whole code right there. I haven’t used that because I was looking for an alternative, and was just wondering why this wouldn’t work.

If you didn’t use any of the events I specified, it obviously won’t work. The alternative would be using a RemoteFunction, but that isn’t safe for invoking the client with. Why can’t you use RemoteEvents?

I can’t actually find a good tutorial, and when I tried it last time, it just broke the system.

Also forgot to mention, look into using :GetPropertyChangedSignal for the local script. That “if” statement checking the “val” variable will run only once. When using :GetPropertyChangedSignal, the code will run every time the value changes, if used correctly. A page on :GetPropertyChangedSignal can be found here.

2 Likes

So should this work?

image

Example of GetPropertyChangedSignal suggested by @TestAccount563344:

val:GetPropertyChangedSignal("Value"):Connect(function()
     if val.Value == 2 then
          gui.Visible = true
          wait(0.3)
          gui.Visible = false
     end
end)
1 Like

This won’t work because you need to :Connect(valuechange) in order for it to work

p.s if that doesnt work try :Connect(valuechange()) because I do not remember how to connect functions as I haven’t been in studio for a while :sweat_smile:

1 Like

You need to connect a function in order for it to work.