When I call FindPartOnRayWithWhitelist on a part that has just been spawned, it doesn’t detect the part unless I add a delay before casting. This is not an issue with FindPartOnRayWithIgnoreList.
wait(0.5)
game.Workspace.ChildAdded:Connect(function(Part)
local Origin = Part.Position + Vector3.new(0, 1, 0)
local Ray1 = Ray.new(Origin, Vector3.new(0, -2, 0))
-- Works if there is a delay
-- wait(0.1)
local h, p = game.Workspace:FindPartOnRayWithWhitelist(Ray1, {Part})
print(h)
-- Prints nil with no delay
end)
wait(0.5)
local Part = Instance.new("Part")
Part.CFrame = CFrame.new(0, 10, 0)
Part.Anchored = true
Part.Parent = game.Workspace
I’m having a very similar issue. I use FindPartOnRayWithWhitelist and bind it to RenderStep. When a part on the whitelist is clicked, the server deletes the part and spawns another one directly behind it. Even though I’m casting a ray with each frame, the FindPartOnRayWithWhitelist still prints out the deleted block as though it’s still getting hit with the ray. It’s only when I move the mouse away from where the part used to exist is when the ray recognizes the part as being destroyed and starts printing out the newly spawned part.
Salutations!
Thank you for submitting this report. We are currently closing out older bugs that are no longer reproducible as we migrate to a new tracking system. Thank you for your patience while this issue was outstanding; our new process is designed to help us resolve incoming bugs more efficiently.
If you are still experiencing this issue, please file a new report via the Bug Wizard so we can take another look.