Title says it all. I can only use bindableevents because if I use a localscript on clickdetector it won’t work. I need to fire it to all clients in order to show a notification that the click detector has been clicked. This is currently my replacement:
game.ReplicatedStorage.bankRobbery.Event:Connect(function()
for i,player in pairs(game.Players:GetPlayers()) do
player.PlayerGui.BankRobbery.Frame.Visible = true
wait(12)
player.PlayerGui.BankRobbery.Frame.Visible = false
end
end)
but it’s not a very good replacement as it only notifies one player at a time. Any ideas?
Change to a remote event, BindableEvents are for sending data to the same script class it came from. (E.g. Sending a message from a server script to another server script and vice versa)
i literally said i can only use bindableevents & you come at me saying to use a remote one. I can’t find a viable replacement because clickdetector only works with server scripts.
You would have a Server Script listening for the click detector being clicked, then have a local script updating the GUI which would be triggered by a remote event.
Clickdetector also works with a localscript. If you still want to use BindableEvent, you can use spawn(function() to run that part of the code in a asynchronous thread or you can use coroutine | Roblox Creator Documentation as well.
Why not insert the local script into StarterPlayerScripts, and then reference the object from there? Theoretically, editing UI from the server can work but is not recommended. The server should manage & replicate data, not interfere with the client-side using that data.