Here is download : Baseplate.rbxl (18.4 KB)
local main = script.Parent.main
local rock = 10
local range = 7
local function SpawnRock()
for i = 1, rock do
local Angle = (math.pi * 2) / rock * i
local X_Pos = math.cos(Angle) * range
local Z_Pos = math.sin(Angle) * range
local oldpos = main.Position + Vector3.new(X_Pos, 0, Z_Pos)
local ray = Ray.new(oldpos, oldpos - Vector3.new(0, 50, 0))
local otherPart, position = workspace:FindPartOnRay(ray, script.Parent, false, true)
local lineBb = Instance.new("Part", workspace)
lineBb.Position = oldpos - Vector3.new(0, 5, 0)
lineBb.Size = Vector3.new(0.15, 0.15, 0.15)
lineBb.Anchored = true
lineBb.BrickColor = BrickColor.new("Really red")
local lineA = Instance.new("Part", workspace)
lineA.Position = oldpos
lineA.Size = Vector3.new(0.15, 0.15, 0.15)
lineA.Anchored = true
local a = (oldpos - position).Magnitude
local b = Instance.new("Part", workspace)
b.CanCollide = false
b.Anchored = true
b.Size = Vector3.new(0.1, 0.1, a)
b.CFrame = CFrame.new(oldpos, position) * CFrame.new(0, 0, -a / 2)
local lineB = Instance.new("Part", workspace)
lineB.Position = position
lineB.Size = Vector3.new(0.15, 0.15, 0.15)
lineB.Anchored = true
end
end
SpawnRock()
I want the line (is local b) reach the âlineBbâ but idk how to fix it, can someone help me.
Idk my script is wrong or FindPartsOnRay is wrongâŚ