Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Ripull 45
10 years ago

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
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. Azarth 3141 — 10y
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 Ripull 45 — 10y
0
Make sure all of the GUI elements have loaded before you try to index them directly. 1waffle1 2908 — 10y

1 answer

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

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

Ad

Answer this question