The player 1 is afk and when the countdown is about to start i spammed the AFK button on player 2 and this happend.
It yields forever…
There’s only one thing in that code causing a yield and it’s the :Wait() on the remote event
What i can do alternative coding on this remote event?
I’ll mark it as solution if the alternative code you gave me works.
What i can do??? to achieve same effect???
If the remote event yielding is the issue here, any alternative?
I’d say, get a dictionary which tags everyone the cutscene played on
local CutscenePlayedOn = {}
We’ll also need a bindable event, (for efficiency sake)
local CutscenePlayedOnTableEmptied = Instance.new(“BindableEvent”)
We can then use a dictionary key, in this case, the player instance (if the player leaves it will automatically get nil’led)
for i,v in pairs(game.Players:GetPlayers())do
if CS:HasTag(v.Character,"Contestant") then
if v.AFK.Value == true then
v.Character:BreakJoints()
else
print("heys")
game.ReplicatedStorage.Network.Gameplay.SwordEnable:FireClient(v)
game.ReplicatedStorage.Network.Camera.Play:FireClient(v,self.Parent.Cameras.Points:GetChildren()) -- fires on client
CutscenePlayedOn[v] = true
end
end
end
Then, when we get to waiting for the cutscene to finish on everyone’s client, INSTEAD of waiting for it to finish through :Wait(), hook it to a function which removes them if they have a key in CutscenePlayedOn
game.ReplicatedStorage.Network.Camera.Stop.OnServerEvent:Connect(function(p)
if CutscenePlayedOn[p] == true then
CutscenePlayedOn[p] = nil
end
local keyExists = false
for _,v in pairs(CutscenePlayedOn) do
keyExists = true
end
if keyExists == false then
CutscenePlayedOnTableEmptied:Fire()
end
end)
We’ll then simply wait for the bindable to fire with
CutscenePlayedOnTableEmptied.Event:Wait()
I’ll test it… if it works!!! ^^
I’ll send you the full code in DMs as sending code in #help-and-feedback:scripting-support is not really something you’re meant to do
Please apply basic debugging to your code to attempt to isolate a source of error. It is improper use of this category to dump all of your code into a thread and request for help fixing this when you are unable to pinpoint an approximate source of error yourself nor have attempted to do so before posting.
Please also keep responses to a minimum. If you have new information or something additional you want to say that’s in small responses, edit your previous posts to include them as opposed to adding new replies. It generates a lot of unnecessary noise for this thread (it’s already at 32 replies).