Have you tried other animations?
Yes,
It still does not work
Update
No solution has worked.
Can you go into your explorer, and double check while it is running that the gun and character are rigged with motor6ds properly?
are you sure there is no error in the output?
Idk try putting the play in a 5 second loop or so and see if itβs only because you spawn later and the animation gets overwritten. (debug and not a solution ofc lol)
Have you tried setting priority to action?
ok now this should work perfectly
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local Animation = {}
local AnimationTracks = {}
local function PlayAnim(AnimName, AnimID)
if hum then
if AnimationTracks[AnimName] then
AnimationTracks[AnimName]:Play()
else
Animation[AnimName] = Instance.new("Animation")
Animation[AnimName].AnimationId = AnimID
pcall(function()
AnimationTracks[AnimName] = hum:LoadAnimation(Animation[AnimName])
AnimationTracks[AnimName]:Play()
end)
end
end
end
local function StopAnim(AnimName)
if AnimationTracks[AnimName] then
AnimationTracks[AnimName]:Stop()
Animation[AnimName] = nil
AnimationTracks[AnimName] = nil
end
end
PlayAnim("Example", "rbxassetid://7116896720") -- to play Animation -- PlayAnim(AnimName, AnimID)
StopAnim("Example") -- to Stop Animation -- StopAnim(AnimName)
Hello,
Thanks for your help, but yes all the rigs are working.
Hello,
Yes, there are no errors when outputted.
Also - I will try your script
Hello, yes I have put the priority to Idle.
Hello,
Amusingly, I did the exact thing to try and debug literally a few hours ago, but it sadly does not work
Well my friend, then the problem is not in the Script
Sorry, but can we see more of the script, your issue may be related to the script logic rather than just not working
my script is work for me
30
I have not tried the script yet, I shall do it now.
and Is working?
30
Nope.
Here is the full script.
local cam = workspace.CurrentCamera;
local plrService = game:GetService('Players');
local runService = game:GetService('RunService');
local RS = game:GetService('ReplicatedStorage');
local wRemotes = RS:WaitForChild('wRemotes');
local wAssetStorage = RS:WaitForChild('wAssetStorage');
local wRigs = wAssetStorage:WaitForChild('wRigs');
local wWeapons = wAssetStorage:WaitForChild('wWeapons');
local humanoid = plrs.LocalPlayer.CharacterAdded:Wait():WaitForChild('Humanoid');
local vModel = wRigs:WaitForChild('UMP-45_Rig'):Clone();
local uis = game:GetService('UserInputService');
local weapon = wWeapons:WaitForChild('UMP-45');
local cWeapon = weapon:Clone();
local player = plrService.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid");
local Animation = {}
local AnimationTracks = {}
local function PlayAnim(AnimName, AnimID)
if hum then
if AnimationTracks[AnimName] then
AnimationTracks[AnimName]:Play()
else
Animation[AnimName] = Instance.new("Animation")
Animation[AnimName].AnimationId = AnimID
pcall(function()
AnimationTracks[AnimName] = hum:LoadAnimation(Animation[AnimName])
AnimationTracks[AnimName]:Play()
end)
end
end
end
local function StopAnim(AnimName)
if AnimationTracks[AnimName] then
AnimationTracks[AnimName]:Stop()
Animation[AnimName] = nil
AnimationTracks[AnimName] = nil
end
end
humanoid.Died:Connect(function()
vModel.Head.CFrame = cam.CFrame;
end)
cWeapon.Parent = vModel;
local motorJ = Instance.new('Motor6D');
motorJ.C0 = CFrame.new(1, -1.5, -2) * CFrame.fromEulerAnglesXYZ(0, -55, 0);
motorJ.Part0 = vModel.Head;
motorJ.Part1 = cWeapon.Handle;
motorJ.Parent = vModel.Head;
local n = 0;
local offset = cWeapon.Handle.CFrame:inverse() * CFrame.new(-2.55, 0.5, 2.5) * cWeapon.Aim.CFrame * CFrame.fromEulerAnglesXYZ(0, 55, 0);
wRemotes.setup:FireServer(weapon);
PlayAnim("Equip", "rbxassetid://7116896720")
local function aimSights(x)
local z = x and motorJ.C0 * offset or CFrame.new();
n = n + 1;
local c = n;
for i = 0, 101, 10 do
if (c ~= n) then
break;
end
runService.RenderStepped:Wait();
motorJ.C1 = motorJ.C1:Lerp(z, i/100);
end
end
uis.InputBegan:Connect(function(x)
if (x.UserInputType == Enum.UserInputType.MouseButton2) then
aimSights(true);
end
end)
uis.InputEnded:Connect(function(x)
if (x.UserInputType == Enum.UserInputType.MouseButton2) then
aimSights(false);
end
end)
local function updateArm(key)
local shoulder = vModel[key].Joint;
local cFrame = cWeapon[key].CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 90) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, 0.5, 0.15);
shoulder.C1 = cFrame:inverse() * shoulder.Part0.CFrame * shoulder.C0;
end
runService.RenderStepped:Connect(function()
vModel.Head.CFrame = cam.CFrame;
updateArm('Right');
updateArm('Left');
wRemotes.modelTilt:FireServer(math.asin((cam.CFrame.LookVector.Y)));
end)
Try setting the priority to action.
what about this
Change it to
local humanoid = plrService.LocalPlayer.CharacterAdded:Wait():WaitForChild('Humanoid');