Ad
Log in to vote
0

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

Asked by 11 months ago
Edited 11 months ago

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

Log in to vote
0
Answered by 11 months ago

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

1
because.... your checking every 30th of a second and not just once hiimgoodpack 1835 — 11mo
0
Seemed to work so... BennyBoiOriginal 161 — 11mo
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. BennyBoiOriginal 161 — 11mo
Ad

Answer this question