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

How do you delete something from every player's playergui?

I need to remove a Gui from a player's playergui. I am trying to remove it from it after two seconds which I have all the before script already made, but then I tell it to remove the gui, but it only deletes the one in the startergui. I need it to delete all of the gui's that were sent out to each player's playergui.

function onJoined(newPlayer)
	local l = Instance.new("TextLabel", game.StarterGui.Banner.Frame)
	l.Name = "PlayerJoined"
	l.Size = UDim2.new(0.98, 0,0.9,0)
	l.Position = UDim2.new(0.02,0,0.05,0)
	l.TextColor3 = Color3.new(255,0,0)
	l.FontSize = ("Size36")
	l.Font = ("ArialBold")
	l.BackgroundTransparency = ("1")
	l.Text = (newPlayer.Name.. " has joined the game!")
	wait(2)
	l:Destroy()  -- It won't remove. everything works up to here.
end
game.Players.PlayerAdded:connect(onJoined)

1 comment

0

local l = Instance.new("TextLabel", game.Players.LocalPlayer.PlayerGui.Banner.Frame)

2 answers

I know where your error is! But first! I must help you fix other things!


#TextColor TextColor is a Color3 value. Color3 is shown as 255 but in reality, 255 is 1! You can test this here! We all know that White is Color3.new(255,255,255). We can test it this way:

if workspace.Color3Value.Value == Color3.new(255,255,255) then
	print("255,255,255")
elseif workspace.Color3Value.Value == Color3.new(1,1,1) then
	print("1,1,1") --This prints. The other does NOT!
end

If you want to get colors like gray:

Color3.new(150/255,150/255,150/255)--You get your number and divide it by 255 for example:
--255,255,255 is white. (255,255,255) divided by 1 is (1,1,1) so (255,255,255) and (1,1,1) are both white.

#The actual problem It was your BackgroundTransparency! BackgroundTransparency is not text. It's a number like:

print(1+1) --2
print("1+1") --Since it is in a textbox, it isn't going to do math. So it prints 1+1.


function onJoined(newPlayer)
    local l = Instance.new("TextLabel", game.StarterGui.Banner.Frame)
    l.Name = "PlayerJoined"
    l.Size = UDim2.new(0.98, 0,0.9,0)
    l.Position = UDim2.new(0.02,0,0.05,0)
    l.TextColor3 = Color3.new(255,0,0)
    l.FontSize = "Size36" --You don't need the parentheses
    l.Font = "ArialBold"
    l.BackgroundTransparency = 1
    l.Text = newPlayer.Name.." has joined the game!"
    wait(2)
    l:Destroy()
end
game.Players.PlayerAdded:connect(onJoined)



Hope it helps!

The reason why it deletes the one in startergui, is because

 l = startergui.banner.frame

1 comment

0

l:Destroy() is not the problem, that part is perfectly fine. The error is on line 9.

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