Client:
Signal.FireServer("picked up dropped item", DropItemPart.Position)
Server:
Signal.ListenRemote("picked up dropped item", function (Player, PartPos : Vector3)
--calculates if the player is actually touching the part
local function isTouching(aPos, aSize, bPos, bSize)
local aMin = aPos - aSize / 2
local aMax = aPos + aSize / 2
local bMin = bPos - bSize / 2
local bMax = bPos + bSize / 2
return (aMin.X <= bMax.X and aMax.X >= bMin.X) and
(aMin.Y <= bMax.Y and aMax.Y >= bMin.Y) and
(aMin.Z <= bMax.Z and aMax.Z >= bMin.Z)
end
local Character:Model = Player.Character
while not Character do
Character = Player.Character
end
local HumanoidRootPart:Part = Character:WaitForChild("HumanoidRootPart")
local CharPos = HumanoidRootPart.Position
local CharSize = HumanoidRootPart.Size
local ItemPos = PartPos
local ItemSize = Vector3.new(1, 1, 1)
local Touching = isTouching(CharPos, CharSize, ItemPos, ItemSize)
print(Touching) --false, because the humanoid root part's position is not actually touching the item
end)
The problem is that the humanoid root part is only covering the chest area of the humanoid. I want it to cover the whole body so the server can accurately determine if the player actually touched the part or is there a way to get the actual position and size of the character?