Hello everyone, I have a problem with my animation that does not want to play when fired in a local script. I think it has to do with the AnimationTrack but I am not sure.
This is also my first time scripting with animation so any extra information is appreciated.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local remote = ReplicatedStorage.Events.Remote:FindFirstChild("TestMoveRemote")
local Players = game:GetService("Players")
local Debounce = true
local Animation = ReplicatedStorage.Assets.Animations.TestAnimEvent:Clone()
local mouse = Players.LocalPlayer:GetMouse()
local Humanoid = Players.LocalPlayer.Character.Humanoid
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent, mouse)
if gameProcessedEvent then
return
end
if Debounce == false then
return
end
if input.KeyCode == Enum.KeyCode.E then
Debounce = false
local AnimationTrack = Humanoid:LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Action4
AnimationTrack:Play()
local mouse = Players.LocalPlayer:GetMouse()
remote:FireServer(mouse.Hit)
wait(1)
Debounce = true
end
end)
Thanks for your time!