i want to make an gui appear when a player hits a part the code i am using is this:
local TextLabel = game.StarterGui.ScreenGui.TextLabel local Frame = script.Parent.Parent.Frame local plr = game.Players.LocalPlayer Frame.Touched:Connect(function(hit) if hit.Name == plr then game.StarterGui.Waith.TextLabel.Visible = true wait(1) TextLabel.TextTransparency = 0.3 wait(1) TextLabel.TextTransparency = 0.2 wait(1) TextLabel.TextTransparency = 0.1 wait(1) TextLabel.TextTransparency = 0 wait(1) game.StarterGui.Waith.TextLabel.Visible = false end end)
Please Help
So, the reason why this script doesn't work is because you are changing the Gui's in the StarterGui, the problem with this is that it doesn't represent the current Gui, which can be found in Player.PlayerGui. I'm not the best at explaining things, so here is a link to the PlayerGui on the roblox Dev Wiki
Anyways, with all that said and done, your script would look like this:
local plr = game.Players.LocalPlayer local TextLabel = plr.PlayerGui.TextLabel local Frame = script.Parent.Parent.Frame Frame.Touched:Connect(function(hit) if hit.Name == plr then plr.PlayerGui.Waith.TextLabel.Visible = true wait(1) TextLabel.TextTransparency = 0.3 wait(1) TextLabel.TextTransparency = 0.2 wait(1) TextLabel.TextTransparency = 0.1 wait(1) TextLabel.TextTransparency = 0 wait(1) plr.PlayerGui.Waith.TextLabel.Visible = false end end)
Let me know if you need any more help!