Hi, i’ve run into a problem with animations
Im trying to make animations for a sword. The character is supposed to swing the sword with both hands. upwards first, then downwards.
However, when i play it, the animations run smoothly on the client, but on the server side, the hand which holds the sword does not move. Code below
repeat wait() until script.Parent.Parent:FindFirstChild("Humanoid")
local userinputservice = game:GetService("UserInputService")
local character = script.Parent.Parent
local equipped = "6267736911"
local left = "6267848534"
local right = "6267786471"
local lunge = "6267935980"
local down = "6268064416"
local debounce = false
userinputservice.InputBegan:Connect(function(put,istyping)
if not istyping then
if script.Parent.Parent:FindFirstChild("Humanoid") then
local input = put.KeyCode
if input == Enum.KeyCode.Q or input == Enum.KeyCode.E or input == Enum.KeyCode.Z or input == Enum.KeyCode.C then
script.Parent.RemoteEvent:FireServer(input)
local animation = Instance.new("Animation")
if input == Enum.KeyCode.Q then
animation.AnimationId = "https://www.roblox.com/asset/?id="..lunge
end
local animationtrack = character.Humanoid:LoadAnimation(animation)
animationtrack.Priority = Enum.AnimationPriority.Action
animationtrack:Play()
end
end
end
end)
(I only scripted the leftswing animation)
Videos below
Definitely not if the code above is still being used. I can clearly tell you’re creating the animation on the client-side resulting in the server not being able to stay in sync.
What I said is correct, and you have to make the animation instance with the id in advance where both the client and server can access it, such as ReplicatedStorage.
repeat wait() until script.Parent.Parent:FindFirstChild("Humanoid")
local userinputservice = game:GetService("UserInputService")
local animations = game.ReplicatedStorage.SwordAnimations
local character = script.Parent.Parent
local equipped = animations.Equipped
local left = animations.Leftswing
local right = animations.Rightswing
local lunge = animations.Lunge
local down = animations.Downswing
local debounce = false
userinputservice.InputBegan:Connect(function(letter,istyping)
if not istyping then
if script.Parent.Parent:FindFirstChild("Humanoid") then
local input = letter.KeyCode
if input == Enum.KeyCode.Q or input == Enum.KeyCode.E or input == Enum.KeyCode.Z or input == Enum.KeyCode.C then
script.Parent.RemoteEvent:FireServer(input)
if input == Enum.KeyCode.Q then
local animationtrack = character.Humanoid:LoadAnimation(left)
animationtrack.Priority = Enum.AnimationPriority.Action
animationtrack:Play()
end
end
end
end
end)
Hi. The animations are replicating, but the hand is still not moving. Above is the code that im using right now