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
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?