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

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

Asked by 5 years ago

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

3 answers

Log in to vote
0
Answered by 5 years ago

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

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.
Log in to vote
-1
Answered by 5 years ago
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?

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 TheOnlySmarts 233 — 5y
0
-1 for deprecated code & no explanation green271 635 — 5y

Answer this question