Hey. I’ve come across a problem while trying to make a way to have a combat system without a tool which was a first time for me. I get a message “Play is not a valid member of Animation” while running the script.
I’ve read a few topics about it but I couldn’t figured it out since I’ve loaded an animation to the character and tried to follow other solutions.
The script:
local player = game.Players.LocalPlayer
local char = player.Character
local hum = player.Character:WaitForChild("Humanoid")
local mouse = player:GetMouse()
local repStorage = game:GetService("ReplicatedStorage")
local cEvent = repStorage.CombatEvent
local CombatAnim = Instance.new("Animation",hum)
CombatAnim.AnimationId= "rbxassetid://5712562366"
local Combat = hum:LoadAnimation(CombatAnim)
local function punch()
CombatAnim:Play()
end
mouse.Button1Down:Connect(function()
punch()
end)
I followed a tutorial for a large portion but I don’t want to directly copy so I tried to make it slightly different.