I would like to close a Gui when a player is not over or under a brick. This means using part.Position and part.Size. Is there a way to combine these two and use .magnitude to make this statement false?
player=game.Players.LocalPlayer flor=game.Workspace.flor while wait(1) do if not(player:DistanceFromCharacter(flor.Position)><=?) then script.Parent.Parent.Visible=false end end
Maybe you can cast a ray above the brick to determine if the character is directly above. Here is some sample code.
local Part = workspace:WaitForChild("PARTNAMEHERE") Part.Touched:connect(function(Hit) if Hit.Parent:FindFirstChild("Humanoid") ~= nil then local Ray = Ray.new(Part.Position,Part.Position + Vector3.new(0,50,0)) local Hit,Position = workspace:FindPartOnRay(Ray) if Hit then -- Your code here end end end