Hi, so basically I'm trying to create a script that enables a GUI when a player enters an area. Right now I've got a part in the workspace and this script in it along with a NumberValue.
script.Parent.Touched:connect(function(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then print("In Zone") script.Parent.Value.Value = 1 end end end) script.Parent.TouchEnded:connect(function(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then print("Left Zone") script.Parent.Value.Value = 0 end end end)
The script works alright but whenever the player jumps the GUI is disabled, there is also some other annoying bugs like when the player goes to the edge of the part and enters again without fully leaving contact with it which results in the GUI being disabled. If there is a more efficient way of doing this please let me know. Any help would be greatly appreciated.