What do you want to achieve? Keep it simple and clear!
Trying to make a part that will spawn model
What is the issue? Include screenshots / videos if possible!
The model that spawn is not spawning correctly the position is wrong
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried searching for solution but found none
local Storage = game:GetService("ServerStorage")
local Box = Storage:WaitForChild("Breakables").Box2
local boxclone = Box:Clone()
boxclone.Parent = script.Parent.Parent.Part
boxclone:MoveTo(script.Parent.Position)
local deb = false
while true do
local child = script.Parent.Parent.Part:GetChildren()
if #child >= 0 and deb == false then
deb = true
wait(10)
local clone = Box:Clone()
clone:MoveTo(script.Parent.Position)
deb = false
end
end
MoveTo() relies on part collisions, as it tries to find the next best non-collision area possible
SetPrimaryPartCFrame() doesn’t, this is probably what you want more but you’ll have to set a PrimaryPart for the Box first & this is a CFrame value
local Storage = game:GetService("ServerStorage")
local Box = Storage:WaitForChild("Breakables").Box2
local boxclone = Box:Clone()
boxclone.Parent = script.Parent.Parent.Part
boxclone:SetPrimaryPartCFrame(CFrame.new(script.Parent.Position))
local deb = false
while true do
local child = script.Parent.Parent.Part:GetChildren()
if #child >= 0 and deb == false then
deb = true
wait(10)
local clone = Box:Clone()
clone:SetPrimaryPartCFrame(CFrame.new(script.Parent.Position))
deb = false
end
end