Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get weapon animations to work in game?

Asked by 5 years ago

I was watching one of those videos where it shows how to rig a weapon that was about almost 3 hours long. I did everything in it and I can't seem to get it to work. Not sure why but here are the scripts I used. It also looks like none of the scripts work in it such as the mobile shoot button.

What it may or should look like: https://imgur.com/a/U2TpJip

What it looks like in-game: https://imgur.com/a/DWvUOHw

https://pastebin.com/8r6ZxUvw - Weapon Localscript

https://pastebin.com/QzR3xpRF

1 answer

Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

You need to own the animation to be able to play it. Make sure the animation you are playing belongs to you. Also, your code seems to be a bit off. I'm not sure if it's pastebin, but there's random stuff in there such as "vBig Grinestroy()", and the first bit of your de-equipt animation is inside of the equip animation without anything after it. another thing, is make sure you're using r15 animations if your characters are r15, r6 if r6 animations.

try running the animation code without any other code so you know that the animation itself is the problem and remember to use your own animations:

local serverStorage = game:GetService("ServerStorage")
local replicatedStorage = game:GetService("ReplicatedStorage") 
player = game.Players.LocalPlayer
local newAnim =nil

replicatedStorage.EquipAnimation.OnServerEvent:Connect(function(player,animation)
    if(game.Players:FindFirstChild(player.Name) and player.Character)then
        newAnim = player.Character.Humanoid:LoadAnimation(animation)
        newAnim:Play()
    end
end)

replicatedStorage.UnequipAnimation.OnServerEvent:Connect(function(player,animation)
    newAnim:Stop()
end)

Ad

Answer this question