for answer, playersWhoVoted in pairs(votedFor) do -- answer is player who wrote the answer
if answer == "Server" then
local answerText = playersAnswers["Server"]
showVotes:FireAllClients({answer, playersWhoVoted,answerText})
showVotesCompleted.OnServerEvent:Wait()
print("completed")
else
local answerText = playersAnswers[answer]
showVotes:FireAllClients({answer, playersWhoVoted,answerText})
showVotesCompleted.OnServerEvent:Wait()
print("completed")
end
completed gets printed twice even when showVotesCompleted has only been fired once, any ideas why?
Once u fired the remote, the code will stop running and start running it on the connection.
Script1 Script2
FireServer() OnServerEvent
Code stop running in the script 1
Code start running in the script 2
I think Wait() just yields the script until the remote is fired no? Still doesn’t answer why completed gets printed twice
:Wait()
will cause the script to pause until the event occurs once. When it does, the function returns the data associated with the event’s firing.
But that would just cause completed to print once which is expected behaviour
Can u confirm both of the printed messages completed
run in a different line in the output?
They do, I don’t see any reason why they wouldn’t