so i’m trying to make a animation that when player pressed Q it will run an animation and will take out knife but sometimes the animation doesn’t fully load and it’s just makes it looks wired.
https://gyazo.com/aaff59455daeec9ff213de8b661a8994
here are the scripts
localscript:
game:GetService("UserInputService").InputBegan:Connect(function(key, prosseced)
if prosseced then return end
if key.UserInputType == Enum.UserInputType.Keyboard then
if key.KeyCode == Enum.KeyCode.Q then
game.ReplicatedStorage.Pressed.Qpressed:FireServer()
end
if key.KeyCode == Enum.KeyCode.LeftControl then
game.ReplicatedStorage.Pressed.CtrlPressed:FireServer()
end
end
end)
script:
local debounce = true
game.ReplicatedStorage.Pressed.Qpressed.OnServerEvent:Connect(function(plr)
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://3778111135"
local animtrak
local character = plr.Character or plr.CharacterAdded:wait()
local knife = character:FindFirstChild("Real")
local HoldCopy = game.ServerStorage.CHARA.Hold.Real:Clone()
local putndown = game.ServerStorage.CHARA.Putndown.Real:Clone()
if debounce then
debounce = false
animtrak = character.Humanoid:LoadAnimation(anim)
animtrak:Play()
wait(animtrak.Length/2)
if knife.Handle:FindFirstChild("LeftHipRigAttachment") then
knife:Remove()
character.Humanoid:AddAccessory(HoldCopy)
else
knife:Remove()
character.Humanoid:AddAccessory(putndown)
end
anim:Remove()
debounce = true
end
end)