My animation doesn't work in game but it works in studio why does this happen and can you help?
Asked by
7 years ago Edited 7 years ago
I put this code in a script because I'm animating a r15 viewmodel for my fps and it works in studio but not in game. This code is in a normal script too.
sorry I have to drag out the title but anyway here is the script.
01 | local player = game.Players.LocalPlayer |
02 | local mouse = player:GetMouse() |
03 | local uis = game:GetService( "UserInputService" ) |
04 | local reloading = false |
05 | local sprinting = false |
07 | local controller = Instance.new( "AnimationController" ) |
08 | controller.Parent = script.Parent |
09 | local idle = controller:LoadAnimation(script.Parent.Idle) |
10 | local shoot = controller:LoadAnimation(script.Parent.Shoot) |
11 | local reload = controller:LoadAnimation(script.Parent.Reload) |
12 | local sprint = controller:LoadAnimation(script.Parent.Sprint) |
21 | shootsound = script.Parent.Fire 2 :Clone() |
23 | mouse.Button 1 Down:connect( function () |
24 | if reloading = = false then |
26 | local shootsound = script.Parent.Fire 2 :Clone() |
27 | shootsound.Parent = script.Parent |
28 | shootsound.MaxDistance = 500 |
29 | shootsound.Volume = 0.3 |
32 | script.Parent.M 1911. Flash.SparkFX.Enabled = true |
33 | script.Parent.M 1911. Flash.Flash.Enabled = true |
34 | shootsound.Playing = true |
37 | script.Parent.M 1911. Flash.SparkFX.Enabled = false |
38 | script.Parent.M 1911. Flash.Flash.Enabled = false |
40 | game.Debris:AddItem(shootsound, 3 ) |
45 | uis.InputBegan:connect( function (input) |
46 | if input.KeyCode = = Enum.KeyCode.R then |
47 | if reloading = = false then |
52 | script.Parent.Mag:Play() |
61 | uis.InputBegan:connect( function (input) |
62 | if input.KeyCode = = Enum.KeyCode.LeftShift then |
63 | if reloading = = false then |
68 | player.Character.Humanoid.WalkSpeed = 24 |
74 | uis.InputEnded:connect( function (input) |
75 | if input.KeyCode = = Enum.KeyCode.LeftShift then |
76 | if reloading = = false then |
81 | player.Character.Humanoid.WalkSpeed = 16 |
this is a long script but I don't know why it won't work in game please help.