I'm creating a fireball and I'd like to create a second sphere around that fireball and weld it but for some reason when I add the second fireball it stops being smooth and it changes the starting position.

Here is my code so far

	local Character = player.Character
	
	local p = Instance.new("Part")
	p.Shape = "Ball"
	p.Size = Vector3.new(1,1,1)
	p.CanCollide = false
	p.Material = "Neon"
	p.CFrame = player.Character:FindFirstChild("HumanoidRootPart").CFrame*CFrame.new(0,3,-4)
	p.Anchored = true 
	
	p.Parent = game.Workspace
	
	local TweenService = game:GetService("TweenService")
	local Goal = {}
	Goal.Size = Vector3.new(12,12,12)
	local TwInfo = TweenInfo.new(0.5)
	local Tween = TweenService:Create(p, TwInfo, Goal)
	Tween:Play()	
	
	local v = Instance.new("BodyVelocity", p)
	v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
	v.velocity = player.Character:FindFirstChild("HumanoidRootPart").CFrame.lookVector*60
	
	local p1 = Instance.new("Part")
	p1.Shape = "Ball"
	p1.Size = Vector3.new(13,13,13)
	p1.CanCollide = false
	p1.Material = "Neon"
	p1.Transparency = 0.5
	p1.CFrame = p.CFrame
		
	local w = Instance.new("Weld")
	w.Parent = p
	w.Part0 = w.Parent
	w.Part1 = p1
	w.C1 = CFrame.new(0, 0, 0)
	
	p1.Parent = game.Workspace
	
	p.Anchored = false

2 comments

0

The starting position is being changed because you're creating a CFrame with the origin as the given value (0, 0, 0). If you look into the Roblox Developer Wiki, Weld.C1 is commonly assigned to the inverse of the CFrame of the part that is being welded to the original part. C0 is assigned to the inverse of the CFrame of the original part. 

0

How would I go about using inverse in my situation? I don't quite understand the ROBLOX Developer Wiki