Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How would you detect if a variable has update?

Asked by 8 years ago

I am trying to make a boat that uses remote events to communicate with the server script. When I tried this:

local seat = nil
seat.Changed:connect(function()

    MoveEvent = seat.RemoteEvent
end)

it gave this error: 10:00:02.427 - Players.Player.PlayerScripts.LocalScript:37: attempt to index local 'seat' (a nil value) notes: I can't just define a variable for that seat. I need it to work with any boat

0
You need to provide a little more information. You mention Remote events but I do not see any remote events present in your script. Necrorave 560 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

If you mean you want this variable accessible from all serverscripts, then you must assign a global variable. So you would do this: _G.seat = nil

Ad

Answer this question