For some reason, :Once() still fires the event twice (printing Unwaiting twice). These prints both happen at the same millisecond so that’s weird. I’ll try to add more print statements to narrow down the issue.
local connection
connection = opMenu.Option1.Activated:Connect(function()
warn("Unwaiting!")
if changed == true then return end
changed = false
chosen = op
pressed = true
warn("They chose "..op)
warn(" ")
connection:Disconnect() -- Prevents it from firing again
end)
if not spawned then
spawned = true
task.spawn(function()
warn("Waiting...")
opMenu.Option1.Activated:Wait()
warn("Unwaiting!")
if changed == true then return end
changed = false
chosen = op
pressed = true
warn("They chose "..op)
warn(" ")
spawned = false — adjust the flag if needed
end)
end
:Wait() only fire once, but it will yield meaning this :Wait() is probably in a loop that havent yet been activated. There is 2 concurrent :Wait() 1 haven’t yet been activated. The other :Wait() activates at the same time because previously it hasn’t yet been activated.
You have to provide more of your code so that we can diagnose the problem, we are only seeing half the picture.
The RunContext is whatever the RunContext property of the script requiring the module is. If it’s set to client (not a LocalScript) it will run in StarterPlayerScripts and PlayerScripts instead of only in PlayerScripts.