Hi i am trying to make a GUI appear on all players in server screens every 10 seconds.
I currently have this code
local Players = game:GetService("Players")
local player = Players.LocalPlayer
game.StarterGui.WannaSkip.TextLabel.Visible = false
while wait(10) do
for i,v in pairs(game.Players:GetChildren()) do
game.StarterGui.WannaSkip.TextLabel.Visible = true
end
end
Im assuming i’d have to use a while loop but when reading other posts it says different but then i cant seem to make any code do what i want.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
for i, player in ipairs(Players:GetPlayers()) do
task.spawn(function()
local PlayerGui = player:WaitForChild("PlayerGui")
while wait(10) do
PlayerGui.WannaSkip.TextLabel.Visible = true
wait(3)
PlayerGui.WannaSkip.TextLabel.Visible = false
end
end)
end
--//Services
local Players = game:GetService("Players")
--//Functions
local function DisplayUI(playerName)
for i, player in ipairs(Players:GetPlayers()) do
task.spawn(function()
local PlayerGui = player:WaitForChild("PlayerGui")
PlayerGui.WannaSkip.TextLabel.Visible = true
task.wait(10)
PlayerGui.WannaSkip.TextLabel.Visible = false
end)
end
end
Players.PlayerAdded:Connect(function(player)
while wait(490) do
DisplayUI(player.Name)
end
end)
local plr = game.Players.LocalPlayer
local PlayerGui = plr:WaitForChild("PlayerGui")
local UI = PlayerGui:WaitForChild("WannaSkip").TextLabel
while wait(10) do
UI.Visible = true
wait(3)
UI.Frame.Visible = false
end
in a localscript in starterplayerscripts.
or just add a localscript in the textlabel itself and do a loop that appear every 10s