Hi Im trying to make a punch script well the thing is that when I tried the script it doesnt work and the output gave me this error: Animation "https://www.roblox.com//asset/?id=1523388494&serverplaceid=0" failed to load in "Animation.AnimationId": Animation failed to load I have tried to change the animation but still doesnt work ill let the script down here
This is the play script:
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = ReplicatedStorage:WaitForChild("PunchEvent")
local ready = true
local function punch(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.Q and ready then
punchEvent:FireServer()
ready = false
wait(0.5)
ready = true
end
end
UserInputService.InputBegan:Connect(punch)
and this is the anim script:
math.randomseed(tick())
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
punchEvent.Name = "PunchEvent"
local animations = {1523385059, 1523388494}
local function onPunchFired(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local humanoid = char.Humanoid
local animation = Instance.new("Animation")
local picked = math.random(1, #animations)
animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
local animTrack = humanoid:LoadAnimation(animation)
animTrack:Play()
local dmgScript = script.DmgScript:Clone()
if picked == 1 then
dmgScript.Parent = char.RightHand
elseif picked == 2 then
dmgScript.Parent = char.LeftHand
end
dmgScript.Disabled = false
wait(0.4)
dmgScript:Destroy()
end
punchEvent.OnServerEvent:Connect(onPunchFired)

1 comment
sorry about the title I was trying another one but the site did let me :C