I tried looking on the developer forums, and on the post I was looking at, there was a solution, I tried the solution and replaced the animation Id with my own animation, it didn’t work.
This is just a LocalScript within a TextButton that is in StarterGui, if I recall correctly, don’t you need to set up a RemoteEvent. I would rather not if I don’t have to but I will if needed to play the animations on a humanoid
Script is located: StarterGui > ScreenGui > TextButton > LocalScript
code:
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://7492057564" -- This is the animation I wanna play
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()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(function(playability)
end)
@notMundaze: That didn’t work, I have no output, I don’t understand. Am I missing something, all I have is this LocalScript, nothing running on the server.
code:
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://7492057564"
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()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(function(PlayAnimation)
end)
Animation still won’t play, I don’t understand, when trying to get the humanoid, the autocorerect wouldn’t appear, maybe that is indicating something? Also, I changed the trackAnimation to plr.Character.humanoid, which is the humanoid variable that I declared at the top.
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://7492057564"
local players = game.Players.LocalPlayer
local character = players.Character
local humanoid = character:WaitForChild("Humanoid")
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()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(function(PlayAnimation)
end)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://7492057564"
local players = game.Players.LocalPlayer
local character = players.Character
local humanoid = character:WaitForChild("Humanoid")
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()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(PlayAnimation)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://7492057564"
local playability = true
function PlayAnimation(animationSource)
if playability == true then
local plr = game.Players.LocalPlayer
local animator = plr.Character.Humanoid:WaitForChild("Animator")
local trackAnimation = animator:LoadAnimation(animation)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(PlayAnimation)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7492057564"
local trackAnimation = nil
local playability = true
local plr = game.Players.LocalPlayer
function PlayAnimation(animationSource)
if playability == true then
trackAnimation = plr.Character.Humanoid.Animator:LoadAnimation(animation)
trackAnimation.KeyframeReached:Connect(function()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(PlayAnimation)