Alright so for some reason, when you test this in studio solo mode, it'll work just fine, but when you go into server testing alone or with others, the arms fall off and it's stopping me from getting any further. I have no idea what's wrong with this code but someone please tell me if you catch something?
---------------------------------------------------------------------------------------
---------------- [ Variables ] --------------------------------------------------------
---------------------------------------------------------------------------------------
local LA = char:WaitForChild("Left Arm")
local RA = char:WaitForChild("Right Arm")
local LAW
local RAW
local FRA
local FLA
local FRW
local FLW
local arms
local AnimBase
local AnimBaseW
---------------------------------------------------------------------------------------
---------------- [ Weld Setup ] -------------------------------------------------------
---------------------------------------------------------------------------------------
-- Set up arms model
function MakeArmModel()
arms = Instance.new("Model", cam)
arms.Name = "Arms"
end
function RemoveArmModel()
arms:Destroy()
end
-- Making AnimBase
function MakeAnimBase()
AnimBase = Instance.new("Part")
AnimBase.FormFactor = "Custom"
AnimBase.Size = Vec3(0.2, 0.2, 0.2)
AnimBase.CanCollide = false
AnimBase.Transparency = 1
AnimBase.Anchored = false
AnimBase.Name = "AnimBase"
AnimBase.Parent = cam
AnimBaseW = Instance.new("Motor6D")
AnimBaseW.Part0 = AnimBase
AnimBaseW.Part1 = Head
AnimBaseW.Parent = AnimBase
AnimBaseW.Name = "AnimBaseW"
AnimBaseW.C0 = CF()
AnimBaseW.C1 = CF()
end
function RemoveAnimBase()
AnimBase:Destroy()
end
-- Making FakeArms
function MakeFakeArms()
local Hum = Instance.new("Humanoid", arms)
Hum.MaxHealth = 0
Hum.Health = 0
Hum.Name = ""
local Shirt = char:WaitForChild("Shirt"):clone()
Shirt.Parent = arms
FRA = char:WaitForChild("Right Arm"):clone()
FRA.Parent = arms
FRA.Name = "Right Arm"
FRA.Anchored = false
FRA.FormFactor = "Custom"
FRA.Size = Vector3.new(0.8,3,0.8)
FRA.Transparency = 0
FRW = Instance.new("Motor6D")
FRW.Part0 = RA
FRW.Part1 = FRA
FRW.Parent = FRA
FRW.C1 = Settings.RightPos
FLA = char:WaitForChild("Left Arm"):clone()
FLA.Parent = arms
FLA.Anchored = false
FLA.Name = "Left Arm"
FLA.FormFactor = "Custom"
FLA.Size = Vector3.new(0.8,3,0.8)
FLA.Transparency = 0
FLW = Instance.new("Motor6D")
FLW.Part0 = LA
FLW.Part1 = FLA
FLW.Parent = FLA
FLW.C1 = Settings.LeftPos
BoltW = tool.Bolt.Bolt
MagW = tool.Mag.Mag
AimPart = tool:WaitForChild("AimPart") --tool:WaitForChild("Kobra"):WaitForChild("AimPart")
end
-- Welding real arms
function WeldRealArms()
RAW = Instance.new("Weld")
RAW.Part0 = AnimBase
RAW.C0 = CFrame.new(0, -1.5, 0)
Torso:WaitForChild("Right Shoulder").Part1 = nil
RAW.Part1 = RA
RAW.Parent = RA
RAW.C1 = Settings.RealRightPos
LAW = Instance.new("Weld")
LAW.Part0 = AnimBase
LAW.C0 = CFrame.new(0, -1.5, 0)
Torso:WaitForChild("Left Shoulder").Part1 = nil
LAW.Part1 = LA
LAW.Parent = LA
LAW.C1 = Settings.RealLeftPos
end
-- Making Gun
function WeldGun()
end
tool.Equipped:connect(function()
MakeArmModel()
MakeAnimBase()
MakeFakeArms()
WeldRealArms()
--WeldGun()
HeadMove.Disabled = false
end)
tool.Unequipped:connect(function()
RemoveArmModel()
RemoveAnimBase()
HeadMove.Disabled = true
end)
