So, when I clone a part, I want to position it inside of a part. Instead, it positions it on top of the part that's supposed to be positioned to.
Here's my script:
local tool = script.Parent.Parent local player = game.Players.LocalPlayer local hum = player.Character:WaitForChild("Humanoid") local animation = game.ServerStorage.Anime local blackthings = game.ServerStorage.Model.Part local db = false tool.Equipped:connect(function(a) for _,v in pairs(tool:GetChildren()) do v.Transparency = 1 end a.Button1Down:connect(function() if not db then db = true animation.AnimationId = "http://www.roblox.com/asset/?id=1575109264" local animTrack = hum:LoadAnimation(animation) animTrack:Play() for _,v in pairs(tool:GetChildren()) do v.Transparency = 0 a = 0 repeat local blackthingsClone = blackthings:Clone() blackthingsClone.Parent = v blackthingsClone.CFrame = CFrame.new(v.CFrame) a = a + 1 print(a) until a == 10 wait() end wait(5) db = false end end) end)
So Vector3 is like positioning a part but with collisions, CFrame for me is the same thing but with no collisions.
On line 23, you’re changing the position, but you want it to go in a part. This is what you would do using CFrame :
blackthingsClone.CFrame = CFrame.new(v.CFrame)
Think of .CFrame as .Position, and replace Vector3.new with CFrame.new. The part should go in the other part with no problems.
I would try anchoring the part like this:
local part = Part:Clone().Parent = -- Location part.Anchored = true
You could also try turning CanCollide off:
part.CanCollide = false