Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I force one part into another (and have it grow in size)?

I'm experimenting with the scripts of the gear, the Mjolnir, which basically creates a shockwave that kills all enemies as well as pushes them away. I've been trying to make a giant person who creates these shockwaves, and I've gotten up to the point where the shockwave is there, but for some reason, it doesn't seem to stay UNDER the foot of the giant person. It goes over his head.

p=script.Parent:GetChildren()
waving=false

for i=1,#p do
	if p[i].ClassName=="Part" or p[i].ClassName=="MeshPart" then
		p[i].Touched:connect(function(hit)
			script.Parent.Boom:Play()
			script.Disabled=true
			local part=Instance.new("Part")
			waving=true
			part.formFactor = 2
			part.Size = Vector3.new(1, 0.4, 1)
			part.Anchored = true
			part.Locked = true
			part.CanCollide = false
			part.archivable = false
			part.TopSurface = 0
			part.BottomSurface = 0
			part.Transparency = 1
			local pos=script.Parent.RightFoot.Position
			part.CFrame=CFrame.new(pos)				-- This is the chunk that 
			print(script.Parent.RightFoot.CFrame)			-- needs work. Some of this
			local decal = Instance.new("Decal")			-- is copied and pasted from
			decal.Face = 1							-- mjolnir scripts.
			decal.Texture = "http://www.roblox.com/asset/?version=1&id=1280730"
			decal.Parent = part
			zombiehurt=script.ZombieHurt:clone()
			zombiehurt.Parent=part
			part.Parent=script.Parent
			zombiehurt.Disabled=false
			part.Name="Shockwave"
			for i=1,30 do
				wait(.005)
				part.Size = Vector3.new(0, 0.4, 0) + Vector3.new(6.4, 0, 6.4) * i
			end
			part.Parent=nil
			script.Parent.JumpAttack.Disabled=false
			script.Parent.CurrentlyAttacking.Value=false
			script:Destroy()
		end)
	end
end

1 answer

Position snaps, CFrame doesn't.

Set the CFrame of part directly to the CFrame of script.Parent.RightFoot - if you index the Position property it is going to snap above the head.

part.CFrame = script.Parent.RightFoot.CFrame;

This discussion is preserved as it was. New answers, comments, and votes are closed.