Hello! Im currently trying to make a tool to play animation, this is the code :
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=5454739249"
function rollplay()
local pAnimm = humanoid:LoadAnimation(anim)
pAnimm:Play()
print("roll!")
end
tool.Activated:Connect(rollplay)
But there is nothing happened!, “roll!” also not writed on output. Is there anything wrong? if yes, please tell me. I got the code from developer.roblox.com and then edit it some. I has been tried to edit deafult animation from that web too, but nothing happened. I tried many tutorial (using keybind to play animation, using mouseclick, using textbutton on gui) but nothing happened too. I really need help right now
local plr = game.Players.LocalPlayer
local tool = script.Parent
function rollplay()
local anim = Instance.new("Animation", plr.Character)
anim.AnimationId = "http://www.roblox.com/asset/?id=5454739249"
local pAnimm = plr.Character:WaitForChild("Humanoid"):LoadAnimation(anim)
pAnimm:Play()
print("roll!")
end
tool.Activated:Connect(rollplay)
I used it before i change to http://www.roblox.com/asset/?id=5454739249 and it doesnt working (then i change it back to rbxassetid://5454739249 but not working too).
Um, this is my 5th day scripting so idk where should i put it. But i put anim.Parent = humanoid
under anim.AnimationID (is it wrong?) and the animation still wont play
Hey, is this particular animation made by you or someone else in your team? I’ve faced similar problems with animations that aren’t owned by me.
Edit: Never mind, stupid question. Have you tried changing the animation priority in the editor to “movement” or “action” so it overrides the default animations?
Is the avatar R6 or R15, if the animation is using a different model other than the avatar it wont work
Try changing the avatar model in the game’s settings to R6 and then R15 and see which one works