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

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

Asked by 8 years ago

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)
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? BlueTaslem 18071 — 8y
0
No priority. Just have it not overlap. I don't care if it's has multiple banners on the screen. jmotoyama 10 — 8y

3 answers

Log in to vote
0
Answered by 8 years ago

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!

Ad
Log in to vote
0
Answered by 8 years ago

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!*

Log in to vote
0
Answered by 8 years ago

Oh I meant Hint for both :C

Answer this question