IDK WHY WHEN I PULL MY WEAPON OUT THE FIRST TIME IT LOOK LIKE THIS
MY LOADSLOTSCRIPT:
function loadSlot(itemName)
local viewmodelFolder = game.ReplicatedStorage:WaitForChild("WeaponViewmodel")
local moduleScript = moduleFolder:FindFirstChild(itemName)
if not moduleScript then return end
for _, v in ipairs(camera:GetChildren()) do
if v:IsA("Model") then
if equipAnim then equipAnim:Stop() end
if reloadAnim then reloadAnim:Stop() end
if emptyReloadAnim then emptyReloadAnim:Stop() end
if idleAnim then idleAnim:Stop() end
if deequipAnim then deequipAnim:Play() end
repeat task.wait() until deequipAnim.IsPlaying == false
v:Destroy()
end
end
local success, settings = pcall(require, moduleScript)
if not success then return end
framework.module = settings
local vm = viewmodelFolder:FindFirstChild(itemName)
if vm then
local clone = vm:Clone()
clone.Parent = camera
framework.viewmodel = clone
if clone:FindFirstChild("AnimationController") then
local function createAnim(id)
local anim = Instance.new("Animation")
local success, loadedAnim = pcall(function()
anim.AnimationId = id
return clone.AnimationController.Animator:LoadAnimation(anim)
end)
if not success then
warn("ā ļø Failed to load animation:", id, "ā", loadedAnim)
return nil
end
return loadedAnim
end
print(settings)
fireAnim = createAnim(settings.fireAnim)
emptyfireAnim = createAnim(settings.emptyFireAnim)
equipAnim = createAnim(settings.equipAnim)
deequipAnim = createAnim(settings.deequipAnim)
reloadAnim = createAnim(settings.reloadAnim)
emptyReloadAnim = createAnim(settings.emptyReloadAnim)
idleAnim = createAnim(settings.idleAnim)
local success, loadedAnim = pcall(function()
local tpIdleAnim = Instance.new("Animation")
tpIdleAnim.Parent = player.Character
tpIdleAnim.Name = "IdleAnim"
tpIdleAnim.AnimationId = framework.module.tpidleAnim
tpIdleAnim = character.Humanoid.Animator:LoadAnimation(tpIdleAnim)
tpIdleAnim:Play(framework.module.tpidleAnim)
tpShootAnim = Instance.new("Animation") -- line 170
tpShootAnim.Parent = player.Character
tpShootAnim.Name = "TpShootAnim"
tpShootAnim.AnimationId = framework.module.tpshootAnim
tpShootAnim = character.Humanoid.Animator:LoadAnimation(tpShootAnim)
end)
end
if framework.viewmodel then
for i, v in pairs(framework.viewmodel:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") then
v.Transparency = 1
end
end
end
if equipAnim then
equipAnim:Play()
end
task.wait(.1)
if framework.viewmodel then
for i, v in pairs(framework.viewmodel:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") then
if v.Name == "Main" or v.Name == "Muzzle" or v.Name == "FakeCam" or v.Name == "Aimpart" or v.Name == "HumanoidRootPart" then
else
v.Transparency = 0
end
end
end
end
local torso = character:FindFirstChild("UpperTorso")
if torso then
if torso:FindFirstChild("FireSound") then torso.FireSound:Destroy() end
if settings.fireSound then
GunEvent.LoadSlot:FireServer(settings.fireSound.SoundId, settings.fireSound.Volume,itemName)
end
end
end
local mouse = player:GetMouse()
mouse.Icon=framework.module.MouseCursor
end