how would I check if my raycast is inside a part, so I can make the player unable to place something:
if RayCastResult ~= nil then
if (RayCastResult.Instance:IsA("BasePart") or RayCastResult.Name:lower() == "baseplate") and (HumanoidRootPart.Position - clientTower.HitBox.Position).Magnitude < maxPlacingDistance then
OkToPlace = true
if newHighlight.FillColor ~= Color3.fromRGB(91, 255, 79) then
newHighlight.FillColor = Color3.fromRGB(91, 255, 79)
newHighlight2.FillColor = Color3.fromRGB(91, 255, 79)
end
else
OkToPlace = false
if newHighlight.FillColor ~= Color3.fromRGB(255, 74, 74) then
newHighlight.FillColor = Color3.fromRGB(255, 74, 74)
newHighlight2.FillColor = Color3.fromRGB(255, 74, 74)
end
end
local newAnglesCFrame = CFrame.Angles(0, math.rad(yOrientation), 0)
local newCFrame = CFrame.new(RayCastResult.Position.X, RayCastResult.Position.Y + yBuildingOffSet, RayCastResult.Position.Z)
clientTower.HitBox.CFrame = newCFrame * newAnglesCFrame
end