Ok so Is there any way I can fire a RemoteEvent from a local script
1 | game.ReplicatedStorage.RemoteEvent:FireServer() |
and make another local script run using that remote
1 | game.ReplicatedStorage.StartTimer.OnClientEvent:Connect( function () |
both scripts are local and It obviously doesn't work, I just want to know if there is a diffrent way of doing this maybe? To give more context - I have a local script in StarterGui that can be run using RemoteEvent, but the only option I have is to use another local script to run that script.
If you want to do this, use a BindableEvent
. A BindableEvent is basically a remote event, but instead of server to client or visa versa, its client to client/server to server,
script A:
1 | game.ReplicatedStorage.BindableEvent:Fire() |
script B:
1 | game.ReplicatedStorage.BindableEvent.Event:Connect( function () |
2 |
3 | end ) |
if you really want it to be in that way then you do it like this you dont need to touch the local script that fires the server in in a server script you do this
1 | event.OnServerEvent:Connect( function (player) |
2 | otherevent:FireClient(player) --give the path to the other remoteevent |
3 | end ) |
and then your other local script looks pretty good to go