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

why is my gui breaking locally?

so I have a gui and it works fine for the first person who joins a new server, and if you reset, then the gui will go back to how it is in studio. also, if a player joins a server that is not new, then that person will see how it looks like in studio. also it will say "toptip is not a valid member of ScreenGui". heres part of my code

function underworld()

print("Underworld has been chosen")
local plrs = game.Players:GetChildren()
for i, v in pairs(plrs) do
local gui = v.PlayerGui.gamegui
wait(5)
script.click:Play() -- Clicking noise
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 10 seconds"
gui.toptip.toptiptext2.Visible = true
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 9 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 8 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 7 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 6 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 5 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 4 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 3 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 2 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 1 second"
wait(.8)
gui.toptip.toptiptext3.Visible = true
gui.toptip.toptiptext3.Text = "Map has been chosen!"
gui.toptip.toptiptext.Visible = false
gui.toptip.toptiptext2.Visible = false
gui.map1.Visible = true
wait(4)

1 answer

--I suggest using the PlayerAdded event for working with multiple players.
--As I see it working better with server sided.
--Let's see here how about we use the variable to the PlayerAdded event
--Where are your ends?
function underworld()
print("Underworld has been chosen")
local Players = game.Players
local plrs = game.Players:GetChildren()
Players.PlayerAdded:connect(function() 
for i, v in pairs(plrs) do
local gui = v:findFirstChild("PlayerGui").gamegui
wait(5)
script.click:Play() -- Clicking noise
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 10 seconds"
gui.toptip.toptiptext2.Visible = true
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 9 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 8 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 7 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 6 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 5 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 4 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 3 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 2 seconds"
wait(.8)
script.click:Play()
wait(.2)
script.click:Stop()
gui.toptip.toptiptext2.Text = "The map will be chosen in 1 second"
wait(.8)
gui.toptip.toptiptext3.Visible = true
gui.toptip.toptiptext3.Text = "Map has been chosen!"
gui.toptip.toptiptext.Visible = false
gui.toptip.toptiptext2.Visible = false
gui.map1.Visible = true
wait(4)
end
end
end)--If this helped accept it.--Must be in a Script

2 comments

0

it still doesnt work,the game breaks but there is nothing in output

0

Sit your visible to true all of them

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