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

How do I make it not overlap? [DETAILS IN DESC.]

This should be easier than the other question I asked. I basically want the script to not overlap. For example, if I join the server, I'll see my banner. But if Qitsi comes in at a split second after I came in, his banner will automatically show. How do I not make it overlap?

game.Players.PlayerAdded:connect(function(player)
if player.Name == "jmotoyama" then
local f = Instance.new("TextBox", game.Workspace)
	f.Text = "Never fear, Jm the FT God is here."
	wait(4)
    f:Remove()
	wait(1)
end
end)

game.Players.PlayerAdded:connect(function(player)
if player.Name == "qitsi" then
local f = Instance.new("Hint", game.Workspace)
    f.Text = "qitsi, the Tower Tormentor has arrived."
    wait(4)
    f:Remove()
	wait(1)
end
end)

2 comments

0

What do you want to happen instead? Do you want to show both for the full amount of time (in the order they happened)? Do you want to have one have priority over the other?

0

No priority. Just have it not overlap. I don't care if it's has multiple banners on the screen.

3 answers

✓ Accepted answer

You should make the PlayerAdded function check both names at once using elseif. Currently for your code, when a player joins, it runs both of the PlayerAdded functions at once, which isn't good at all. You also have a few more problems, such as you using remove instead of Destroy.

game.Players.PlayerAdded:connect(function(player)
	if player.Name == "jmotoyama" and not workspace:FindFirstChild("TextBox") then
		local f = Instance.new("TextBox", workspace)
    	f.Text = "Never fear, Jm the FT God is here."
    	wait(4)
    	f:Destroy()
    	wait(1)
	elseif player.Name == "qitsi" and not workspace:FindFirstChild("TextBox") then
		local f = Instance.new("TextBox", workspace)
    	f.Text = "qitsi, the Tower Tormentor has arrived."
    	wait(4)
    	f:Destroy()
    	wait(1)
	end
end)

Also, as pluginfactory explained, you need to check if the textbox is already in workspace or not. To do this, just add on to the check at the top of the code to see if it is already in workspace.

If this helped, make sure to thumbs up and accept this as your answer!

all you have to do is make sure that the textbox isn't in workspace when qitsi joins

game.Players.PlayerAdded:connect(function(player)
if player.Name == "qitsi" and not game.workspace:findFirstChild("TextBox")then
local f = Instance.new("Hint", game.Workspace)
    f.Text = "qitsi, the Tower Tormentor has arrived."
    wait(4)
    f:Remove()
    wait(1)
end
end)

*Hope this Helps!

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