Basically, I made a ScrollingFrame and put a bunch of TextButtons in, and the idea was when you click a certain text button, your character would do an animation. I tried a few things but none of them worked, though one of them DID work, but only in studio, and when I team tested in studio with my friend, he couldn't see the character playing animations.

I'm not sure what's wrong with the script, though I did it in a LocalScript and then pasted the script in all the TextButtons.

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://8836599773"

local trackanimation = nil
local playability = true

function playAnimation (animationSource)
	if playability == true then
		local plr = game.Players.LocalPlayer
		trackanimation = plr.Character.Humanoid:LoadAnimation (animation)

		trackanimation.KeyframeReached:Connect(function()
			print("Animation Played")

		end)
		trackanimation:Play()
	end
end
script.Parent.MouseButton1Click:Connect(playAnimation)

Any help is appreciated, I can elaborate below.

3 comments

0

First off, you need to make sure the animation is published to the appropriate owner. Ie: If the animation is for a game in a group, make sure you select the group because by default it publishes it to your own library. That's one mistake I made when I was first doing animations. Your script seems fine to me

0

That may be it, I'll test it out. Ty!

0

Period it works