#When firing a RemoteEvent, can you make the original script WAIT until the event is finished?
1 messages · Page 1 of 1 (latest)
could you give me an example of how one would call the function? what I'm doing is this:
local enemyTurn = ReplicatedStorage:WaitForChild("EnemyTurn")
if enemyTurn then
enemyTurn:FireServer()
end ```
@marsh roost Sorry for the ping, could you tell me how I'd format the code for this differently?
oke
wait
This is a pretty jank way to use it but here:
--Local script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = ReplicatedStorage:WaitForChild("RemoteFunction")
print("Start")
remoteFunction:InvokeServer()
print("End")
--Will take 3 seconds
--Server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = ReplicatedStorage.RemoteFunction
remoteFunction.OnServerInvoke = function(player)
task.wait(3)
end
so instead of EventName:FireServer(), it is EventName:InvokeServer()?
kk, thank you!
hey again, I'm a little stuck, I think..? I've copied everything down, but it's not properly firing the server. I'm getting an error regarding using "player" as a parameter
Workspace.Event Script Stuff.EnemyTurn:206: attempt to call a Instance value, with "player" in the parinthesis being highlighted as the error