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

How to create a pop up text label that appears only once ... ?

Hey! I'm very new to scripting in roblox, but I'm trying to create a game for my nephew. In one of the levels, you need to get to 5 checkpoints in order to be tp'd to the next level. However, I'm having trouble figuring out how to make a text label pop up with instructions on what to do once you've entered the level, and then disappear and not show up again. I tried to follow various youtube videos, but I've been unable to make them work. And since I'm so new to lua (and scripting in general), I'm unsure where I'm going wrong!

This is what I have so far. i got it from a youtube video, which told me to put a button in a frame under StarterGui. However, the frame stays up upon connection, and then never disappears!

game.Players.PlayerAdded:Connect(function(plr) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then plr.PlayerGui.ScreenGui.Frame.Visible = true end end) end)?

Any help would be much appreciated

2 comments

0

Use lua brackets

3 answers

You can use :Destroy() in your code to destroy the TextLabel from the server.

Try using :Destroy() it deletes it meaning it no longer exists in your game, also use :Connect, :connect may not work in the near future

Script (see line 4):

game.Players.PlayerAdded:Connect(function(plr) 
 script.Parent.MouseButton1Click:Connect(function(hit) 
if hit.Parent:FindFirstChild("Humanoid") then
 plr.PlayerGui.ScreenGui.Frame:Destroy() --Destroys it.
end end) end) --btw it looks better like that.
game.Players.PlayerAdded:Connect(function(plr) 
	script.Parent.Touched:connect(function(hit) 
		if hit.Parent:FindFirstChild("Humanoid") then 
			plr.PlayerGui.ScreenGui.Frame.Visible = true
		wait(5)
			plr.PlayerGui.ScreenGui.Frame.Visible = false
		end 
	end) 
end)

Is this what you're looking for?

2 comments

0

Good job but you can't just type the script fixed, you have to explain how it works and what it does, also on line 2 connect is deprecated, use Connect

0

-1 for deprecated code & no explanation

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