You can write your topic however you want, but you need to answer these questions:
Hello Developers,
I have a issue with Raycasting Returning a nil value . I tried looking for a solution on the Devforum. Could anyone assist me Please!
- Here is the Module script :
if closetItem then
local primaryPart = Player.Character.PrimaryPart
local Parts = game.Workspace.Items:GetDescendants()
print(Parts)
warn(Magnitude," "..Object.Name)
if ClosestDis <= 10 then
warn("Beep Boop "..Object.Name)
wait()
local ray = Ray.new(primaryPart.Position, (closetTreasure.Position - primaryPart.Position).Unit * primaryPart.Radius.Position)
local hitPart, hitPosition = game.Workspace:FindPartOnRayWithWhitelist(ray, Parts, true )
warn(hitPart)
print(game.Workspace.Items:GetDescendants())
local S, E = pcall(function()
hitPart:Destroy()
end)
if S then
print("Deleted Yetted")
print(S)
elseif E then
print(E)
end
end
The Module Script is Required in a local script.