Hi there! I am having this problem where, when a function from a module is called, it won’t call it. That is a bit confusing, let me elaborate more:
So basically, when the player joins the game, a bunch of module scripts are set to run. They run perfectly fine. However, when the player dies, I need the functions to run again, otherwise they no longer work. So i use a remote event and activate the modules again. Most of them run, but some do not. The ones do not all have something in common, they all use a while true loop. So I have been trying to debug this for a long time.
This is supposed to run when the player dies. however it does not:
the required function:
local update = true game.ReplicatedStorage.Remotes.Dead.OnClientEvent:Connect(function() update = false end) coroutine.wrap(function() function QuestHandler:Initiate() update = true while update == true do QuestHandler:CheckForUpdates() wait(1) end end end)()
As you can see, I have tried a bunch of things to try and make it work. I tried placing it under a coroutine wrap, I tried disconnecting the while loop, making update false then true again.
There are no errors in the output.
i have run out of ideas of what I could try next. Any help would be appreciated.