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.

5 comments
raycasting maybe?
http://wiki.roblox.com/index.php?title=Ray
Thanks I'll look into that
It makes a lot more sense to use a Region3 here. It's practically what they exist for. Give it a look and let me know if you have questions: https://developer.roblox.com/api-reference/datatype/Region3
You're right summer, good call. Both CAN be used but i agree thats the better option.