I've been trying to make a gun with animations and its all working so far. I've got a reload animation that plays an animation when mousebutton2 is clicked. The magazines transparency is set to 1 and a magazine is cloned from replicatedstorage. the cloned part is welded to the right hand (From the players view) but for some reason the magazine part is welded in the centre of the baseplate and when the animation plays, it moves but far behind the character. I've tried fixing the CFrame but im not entirely sure how to do it. This is the reload animation script:

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
local ReloadAnimation = h:LoadAnimation(script.Parent:WaitForChild("M60Reload"))
local Player = game.Players.LocalPlayer
local M60 = script.Parent
local WeldConstraint = script.Parent.AmmoBoxWeld
local AmmoBox = script.Parent.M60.AmmoBox
local AmmoClone = game.ReplicatedStorage.AmmoBoxWeld

M60.Equipped:Connect(function(Mouse)
	Mouse.Button2Down:Connect(function()
		local AmmoBoxClone = AmmoClone:Clone()
		AmmoBoxClone.Parent = M60.Parent.LeftHand
		AmmoBox.Transparency = 1
		print("Transparent")
		WeldConstraint.Parent = script.Parent
		WeldConstraint.Part0 = AmmoBoxClone
		WeldConstraint.Part1 = M60.Parent.LeftHand
		ReloadAnimation:Play()
		wait(1.9)
		AmmoBox.Transparency = 0
		AmmoBoxClone:Destroy()
		
	end)
end)

Any help would be appreciated!

2 comments

0

nvm i fixed it lol

0

may you please post the final code here? someone may have the same problem and they cannot see the code