Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local worldInfo = worldGlobals.worldInfo
- local importantValue = 0
- worldGlobals.CreateRPC("server", "reliable", "SetImportantVariable",
- function(newValue)
- importantVariable = newValue
- end
- )
- worldGlobals.CreateRPC("client", "reliable", "RequestImportantVariable",
- function()
- if worldInfo:NetIsHost() then
- worldGlobals.SetImportantVariable(importantVariable)
- end
- end
- )
- -- Each player requests the important variable upon joining
- worldGlobals.RequestImportantVariable()
- -- Only the host increases the important value, and he sends it to everyone
- if worldInfo:NetIsHost() then
- while true do
- Wait(Delay(5))
- importantValue = importantValue + 1
- worldGlobals.SetImportantVariable(importantVariable)
- end
- end
Add Comment
Please, Sign In to add comment