I am trying to make a sort of item drop system however i want it to drop on certain terrain however, i cant detect terrain! Here is my code:
local x = math.random(-1300,1300) local z = math.random(-1300,1300) local ray = Ray.new(Vector3.new(x,500,z), Vector3.new(90,0,0)) local part, position = workspace:FindPartOnRay(ray, workspace.Spawn, true, false) print(part)
This only returns nil, so i have no idea what the problem is
i found the problem it was because the racast was too high
here is now what i have:
local x = math.random(-1300,1300) local z = math.random(-1300,1300) local ray = Ray.new(Vector3.new(x,180,z), Vector3.new(0,-180,0)) local part, position, norm, mat = workspace:FindPartOnRay(ray) print(mat, position, part, norm)