So im making plot stuff and i need the raycast to ignore everything and find the plot piece below it but im not sure howd i go about doing that.
Ignore everything except whats in the circle
PlacementEvent.OnServerEvent:Connect(function(Player,PreviewObject,ObjectCFrame)
local Object = ObjectFolder:FindFirstChild(PreviewObject):Clone()
Object:SetPrimaryPartCFrame(ObjectCFrame)
Object.Parent = game.Workspace
wait(1)
local mainp = Object.MainPart
local startpos = mainp.Position
local raydirection = Vector3.new(0,-100,0)
local raycastresults = workspace:Raycast(startpos, raydirection)
if raycastresults then
local parthit = raycastresults.Instance
print(parthit.name)
end
end)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {workspace.Plots}
raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
raycastParams.IgnoreWater = true
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResults then
local parthit = raycastResults.Instance
print(parthit.name)
end