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

Object in PlayerGui not showing up?

Asked by
Teeter11 281 Moderation Voter
9 years ago

Teleporting players in studio it works, this doesn't work in the actual game though.

MainGui is in StarterGui

Players teleport about 20 seconds after spawning in, which is the code that is ran below.

Any questions just leave a comment. Thanks!

Error log:

imgur.com/DSTpSAz

Code:

function teleportPlayers()

    playersT = game.Players:GetChildren()
    spawns = map.Spawns:GetChildren()

    numPlayers = game.Players.NumPlayers

    game.Workspace.ServerStats.FuelAmount.MaxValue = numPlayers*3       

    for i = 1,#playersT do

        randSpawn = spawns[math.floor(math.random(1,#spawns))]  

        playersT[i].Character.Torso.CFrame = CFrame.new(randSpawn.CFrame.X,randSpawn.CFrame.Y+3,randSpawn.CFrame.Z)

        randSpawn:Destroy()         

        playersT[i].PlayerGui.MainGui.Alive.Value = true    -- says that MainGui is not valid but it is

    end

end

Answer this question