I am trying to make a message pop up when i joined the game but i am having troubles making it visible to the players is there a better way i could make this?
local Players = game:GetService("Players")
local Message = script.Parent.TextLabel
local WatchDogsPlayz = game.Players
game.Players.ChildAdded:connect(function(Players)
if game.Players.WatchDogsPlayz.ChildAdded then do
wait()
if Message.Visible == false then
Message.Visible = true
wait(7)
Message:Destroy()
end
end
end
end)
Hello,
Where is the script located? In order to do a cooldown you will need a Debounce
local Players = game:GetService("Players")
local Message = script.Parent.TextLabel
local WatchDogsPlayz = game.Players
local debounce = true --Cooldown Handler
game.Players.ChildAdded:connect(function(Players)
if game.Players.WatchDogsPlayz.ChildAdded then
wait()
if Message.Visible == false and debounce == true then
debounce = false
Message.Visible = true
wait(7)
Message:Destroy()
debounce = true
end
end
end
PS: You don’t need to add Do after Then
1 Like
The script is in the starter gui
local message = script.Parent.TextLabel
game.Players.PlayerAdded:Connect(function(player)
if player.Name == "WatchDogsPlayz" and message.Visible = false then
message.Visible = true
wait(7)
message:Destroy()
end
end)
Now, I do recommend to check by the player’s user id. Because if you say if the player’s name is equal to WatchDogsPlayz, do whatever. But what happens if they change their username? Then it wont show up. So you can say:
if player.UserId == "" and message.Visible == false then -- There user id here