so like my last post i am trying to make a game tips and tricks menu where if you walk near a object, it will show a gui. when you touch an invinsible brick, if will show the menu but i want it to close when you are not touching it. here is my script
script.Parent.Touched:Connect(function(hit) local Player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent) if Player then Player:WaitForChild('PlayerGui'):WaitForChild('Tips').Enabled = true elseif player.PlayerGui.Tips.Enabled = false end end)
Elseif
is followed by another argument, therefore you should replace it with else.
script.Parent.Touched:Connect(function(hit) local Pl = hit.Parent.Name local player = game.Players:WaitForChild(Pl) if player then player:WaitForChild('PlayerGui'):WaitForChild('Tips').Visible = true else player:WaitForChild('PlayerGui'):WaitForChild('Tips').Visible = false end end)