Hi! I'm trying to make an Obstacle course and when you complete a stage/floor and you step on the checkpoint, in an open/close GUI, a TextButton appears saying Floor1, Floor2, etc and when clicked on, it will teleport you to the desired stage that you have completed already. I have used the script below but the TextButton (Floor1 etc) isn't appearing when the checkpoint(part) is touched. Please help. If you need more information, reply to this question.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then game.Players.LocalPlayer.PlayerGui.LvlMenu.Frame.Floor1.Visible = true end end)
I've also tried this:
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then game.StarterGui.LvlMenu.Frame.Floor1.Visible = true end end)
There's a couple of problems with your script.
Firstly, you're changing properties of childs inside of a Player from a ServerScript which is a huge no-no. You should always change properties within a player using a LocalScript.
Secondly, ":connected" is deprecated and will soon be removed. Use ":Connect" instead.
Thirdly, use more ":FindFirstChild" and ":WaitForChild". Store the path in variables one by one to make sure your script will never error.
Fourthly, it may not be the script's problem. Check your Explorer and see if your GUI is correctly positioned.
About the second script, changes in StarterGui won't replicate to players in real time. They will only apply when they respawn and it will apply to all players. (If changed from ServerScripts)
Hopefully this can fix your problem.