Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this script unreliably disabling a script in a player's character? [Answered]

So I have a server script that is in StarterCharacterScript that's about Pathfinding. I have another script that handles the game and how it runs. After some time, the GameManager script is supposed to loop through the players in game.Players and get their character and disable the Pathfinding script which most of the time, it doesn't do and sometimes one player has it enabled by the GameManager script.

GameManager (shortened because the other parts were irrelevant):

for i,v in pairs(game.Players:GetPlayers()) do
	
	v.Character.Pathfind.Disabled = false	
	
end

1 answer

Seemed to fix it by adding a while wait() do loop around the for i,v in pairs(game.Players:GetPlayers()) do.

3 comments

1

because.... your checking every 30th of a second and not just once

0

Seemed to work so...

0

Or maybe I did something else that fixed it, honeestly I have no clue. I just seem to think that its what fixed it.

This discussion is preserved as it was. New answers, comments, and votes are closed.