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

Why is my GUI script not working when everything is spelled correctly and in the right place??

Asked by 4 years ago

This is the code:

game.Players.LocalPlayer.PlayerGui.Loading.TextLabel.Visible = true

wait(10)

game.Players.LocalPlayer.PlayerGui.Loading.TextLabel.Visible = false

also its on a localscript in starter player scripts

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If this is your whole code block, there a lot of flaws, number 1, are you letting the players assets load in? and number 2 is you are not using proper variables to make sure the script knows what your talking about

try defining your variable like this

Also You should wait for the player to join the game so it happens for every player!

local players = Game:GetService("Players") -- this is the players service
local localPlayer = players.LocalPlayer
local PlayerGui = localPlayer.PlayerGui or localPlayer:WaitForChild("PlayerGui") -- this is waiting for player gui to appear
local Loading = PlayerGui.Loading

players.Playeradded:Connect(Function(Player) -- this is waiting for the player to join, when they do it will start the function

Loading.TextLable.Visable = True
Wait(10)
Loading.TextLable.Visable = False

end)
Ad

Answer this question