You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to have a sword Animation, that plays everytime you click, and I will add a debounce!
What is the issue? I’ve done everything I am supposed at least I think but when I click the animation doesn’t play but it prints
What solutions have you tried so far? I did look on the developer forum and found either to advanced sword scripts or just people chatting about it. and I made it a function instead of calling it when it is activated
local function AnimationPlay()
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char.Humanoid
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://6361091778"
local animTrack = humanoid:LoadAnimation(animation)
animTrack:Play()
print(char)
end
script.Parent.Activated:Connect(function()
AnimationPlay()
end)
You should use a ServerScript instead. Heres an example:
local function AnimationPlay(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animationId = 00000000 -- animation id here
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationId
local animTrack = humanoid:LoadAnimation(animation)
animTrack:Play()
end
script.Parent.Activated:Connect(AnimationPlay)