Help on spawning guns on worldcframe of attachment

the part isnt spawning where demanded and not appearing.

here’s a video and script

local part = script.Parent.Parent
local attachment = part.Parent.Part
local realattachment = attachment.Attachment
local tweenService = game:GetService("TweenService")
local folder = game.ReplicatedStorage.important.guns
local guns = folder:GetChildren()

local function spawnguns()
	for i = 1, 7 do
		local gun = guns[i % #guns + 1]
		local clone = gun:Clone()
		clone.Parent = realattachment
		clone.CFrame = realattachment.CFrame
		wait(0.3)
		clone:Destroy()
	end
end
	

local function rotatePart()
	tweenService:Create(part, TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Orientation = part.Orientation + Vector3.new(90, 0, 0)}):Play()
end

local function movePart()
	tweenService:Create(part, TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Position = Vector3.new(7, 2.659, 23.39)}):Play()
end

local function movePart2()
	tweenService:Create(attachment, TweenInfo.new(7, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Position = Vector3.new(6.815, 3.115, 22.49)}):Play()
end

script.Parent.Triggered:Connect(function()
	rotatePart()
	movePart()
	movePart2()
	spawnguns()
end)
External Media
realattachment.WorldCFrame

And I think you can also use ToWorldSpace if that doest work.

1 Like

it works now but the gun part is now like flipped…
do i change the orientation of the realattachment or what?

You might be able to do this:

realattachment.WorldCFrame * CFrame.Angles(x, y, z)

However. Keep in mind that CFrame.Angles uses radians, and nor degrees to apply Rotations.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.