Hi, I’d like to shoot a Ray from a part I’ve created under the map, in the upwards direction. I want to use this to move the part to the result of the ray, as well as copy it’s color and material!
In this script, I actually shoot a ray straight downwards already, and that seems to be working just fine.
I tried reversing it, and now for some reason the ray’s from the parts are shooting straight downwards
(I tested this by creating a part below the parts and checking for a result)
Here’s my code:
for i = 0, craterPieces do
local zRand = math.rad(math.random(-15,15))
local part = Instance.new("Part")
part.CFrame = belowFloor*CFrame.Angles(0,math.rad(i*360/craterPieces),0) * CFrame.new(0,0,-4*2) * CFrame.Angles(math.rad(35),0,zRand)
part.CanCollide = false
part.Anchored = true
part.Parent = workspace.fx
local partPos = part.CFrame.Position
local endPos = part.Position*Vector3.new(0,20,0)
local newResult = workspace:Raycast(partPos, endPos, params)
if newResult then
print(newResult)
part.Material = result.Material
part.Color = result.Instance.Color
else
warn("no result")
end
I’ve tried looking on the hub, I’ve watched YouTube videos, I’ve asked in servers, I’m stumped, thanks for the help!
P.S. this is to make a crater, lol