While Loop stops for no apparent reason

I have a LocalScript in StarterPlayerScripts that handle most of the client stuff. In this local script I have a while loop which just refuses to run after waiting for no apparent reason. It was working yesterday, I didn’t change anything but it just stops now?

-- Part of the script before the loop (which runs fine)
while true do
	print("A") --> prints A
	local Delta = task.wait(0.05)
	print("B") --> Doesn't print B??
	-- Rest of the Loop

It’s not like it’s the variable’s fault, literally just waiting causes the script to break

image

(B Still doesn’t print, Set Delta does print)

I just tried your code and it seems to be working on my end

image

1 Like

Ok so I think I figured it out by finding that there’s no longer PlayerScripts Instance inside the Player… Why does that even happen?

image

Maybe you have another script deleting it? I mean that’s really the only way it wouldnt be there

Hmm this is weird

Player:WaitForChild("PlayerScripts").Destroying:Connect(function()
	print("Destroyed") --> prints Destroyed
end)

Yeah maybe you have some sort of virus, because what script would even need to delete that folder?

Nvm I figured it out I had a local script that was deleting StarterPlayerScripts :man_facepalming: (I did script.Parent:Destroy() instead of script:Destroy() on accident)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.