Detect if player is under a part

I’m trying to make an airdrop thing but I want to make it so it checks if the player is under a part then when the player is not under a part the airdrop script runs?

Not sure what you want, but if you want to detect if the player’s character is under or over a part you should do something like this:

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local Client = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local Character = Client.Character or Client.CharacterAdded:Wait()

local Drop = workspace.Drop

RunService.RenderStepped:Connect(function()
	if Character:GetPivot().Position.Y >= Drop.Position.Y then
		print("Player is over the part")
	else
		print("Player is under the part")
	end
end)
3 Likes

I mean like a raycast for everypart. not just a specific

1 Like

You could check if a character HumanoidRootPart is positioned on the Y axis below/above the airdrop.

I would say create a Region3 below the part(where players will take shelter) and then check if the player is in that region.

Follow @octanagolamen suggestion. Use Region3 and Raycast because in my opinion Raycast alone isn’t that great if there are shelters.

1 Like