-
What do you want to achieve?
I want to a Ray to be casted that goes from one part to all players on the map. -
What is the issue?
The ray is not working in general. The part is not detected if it’s a character’s body part. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking up solutions for my specific scenario but couldn’t find any! Thanks for any help.
local Attacking = coroutine.wrap(function()
while wait() do
for i, v in pairs(workspace.Live:GetChildren()) do
local PlayerPosition = v.HumanoidRootPart.Position
local ScpPosition = workspace:WaitForChild("Scp-173").Position
local IgnoreList = {workspace["Scp-173"]}
for i, v in pairs(workspace.SCP173DefaultMovement:GetChildren()) do
table.insert(IgnoreList, v)
end
local RayCast = Ray.new(ScpPosition, PlayerPosition)
local Part, HitPosition = workspace:FindPartOnRayWithIgnoreList(RayCast, IgnoreList)
if Part.Parent == Character then
print("Ray is hitting a player")
else
print("Ray is not hitting a player")
end
end
end
end)
Attacking()