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

My script seems to skip over this sometimes (lag related?)

Sometimes, this block of code doesn't execute usually when there are more players in the game. What can I do to make sure it will work without skipping any player? Could the false parameter on TweenPosition cause it to skip?

	for i,v in pairs(game.Players:GetChildren()) do
		if (v.Character ~= nil) then
			if v.Character:FindFirstChild("Health")~=nil then
								wait()
				v.Character.Health:Destroy()
				game.Players[v.Name].PlayerGui.GameGui.Intermission:TweenPosition(UDim2.new(0.5, -50, 1, 0), "Out", "Linear", .3, false)
				--game.Players[v.Name].PlayerGui.GameGui.Intermission.Visible = false
				game.Players[v.Name].PlayerGui.LocalPlayerScripts.Intermission:Stop()
			end
		end
	end

3 comments

0

The only reason I can see that it would error is because you call this before the player is done loading and something is nil. That or when when they join, the loop is already in process and they won't be added to the table.

0

It keeps happening all the time throughout the script. Like for instance, player's health doesn't get restored to 100, players dont get moved onto the map and other junk like that which should not happen

0

Make sure all of the GUI elements have loaded before you try to index them directly.

1 answer

I think it's the :Stop() method you called on the Intermission Gui (Frame?).

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