So im firing a ray benith my character, but the problem is if i turn my character around the circle around me stays the same, so it looks as if the ability is casted side ways (as show in the video)
code:
for h = 1, numCircles do
local numParts = rnd:NextInteger(30, 35)
for i = 1, numParts do
local rock = Instance.new("Part")
local rx = pos.X + rnd:NextNumber(-1,1)
local rz = pos.Z + rnd:NextNumber(-1, 1)
local lookAt = Vector3.new(rx, pos.Y, rz)
local orientation = Vector3.new(rnd:NextNumber(-60, 60), rnd:NextNumber(-60, 60), rnd:NextNumber(-60, 60))
local lv = CFrame.new(pos, lookAt).LookVector
local position = pos + (lv * radius * math.clamp(h/numCircles, 0.4, 1))
local cf = CFrame.new(position, pos + lv + orientation)
local rockSize = Vector3.new(rnd:NextNumber(1.5, 2.2), rnd:NextNumber(1, 2), rnd:NextNumber(1.4, 2))
rockSize *= h/numCircles
local rp = RaycastParams.new()
rp.FilterDescendantsInstances = {workspace["Effects"]}
local floorRay = workspace:Raycast(cf.Position + Vector3.new(0, 3, 0), position - Vector3.new(0, 100, 0), rp)
if floorRay and floorRay.Instance.Anchored then
local colour = floorRay.Instance.Color
local mat = floorRay.Instance.Material
rock.Size = Vector3.new(0, 0, 0)
rock.Position = floorRay.Position
rock.Orientation = orientation
rock.CanCollide = false
rock.Anchored = true
rock.TopSurface = Enum.SurfaceType.Smooth
rock.Color = colour or Color3.fromRGB(83, 86, 90)
rock.Material = mat or Enum.Material.Slate
rock.Parent = workspace["Effects"]
TweenModule.obj(rock, "Quad", "Out", 0.2, {Size = rockSize})
task.spawn(function()
task.wait(5)
local fallTween = ts:Create(rock, rocksTI, {Position = rock.Position - Vector3.new(0, rock.Size.Y/2, 0)})
fallTween:Play()
fallTween.Completed:Wait()
rock:Destroy()
end)
end
end
task.wait()
end
video: