Answers for "Roblox check if plr is in area"

Lua
2

Roblox check if plr is in area

--local script under the detector part, I believe 'HymanoidRootPart' could be
--also set to the feet but idk how do do that.

local Part = script.Parent
Part.Touched:Connect(function() end) -- Just for a TouchInterest to occur on a CanCollide false part

function CheckIfPlayerIsInArea(Part,Character)
    local touching = Part:GetTouchingParts()
	for i=1,#touching do
		if touching[i] == Character.HumanoidRootPart then
			return true
		end
	end
	return false
end

-hope this helps :)
Posted by: Guest on January-04-2021

Browse Popular Code Answers by Language