Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[ANSWERED] Why does my friend's animation not work - I have action enabled?

All in all, my friend has made at least 5 animations for a tool, and when you click it makes you play the animation. He set the animation to action, and the script runs my animation perfectly. But when we change the AnimationId to his animation, it doesn't work. Does anyone have any idea why this doesn't work? My script:

AnimationId: rbxassetid://5357281801

local spells = {
	"lumos",
	"nox"			
}

local activeSpell
local tool = script.Parent

repeat wait() until game.Players:GetPlayerFromCharacter(tool.Parent)
local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
local db = false
local cooldown = 3

--possible future stats     local mpc = plr.leaderstats.MPC.Value

tool.Activated:Connect(function()
	if not db then
		db = true
		local anim = game.ReplicatedStorage:FindFirstChild("CastWand")
		local animtrack = plr.Character.Humanoid:LoadAnimation(anim)
		animtrack:Play()
		if activeSpell ~= nil then
			print("Working!")
		end
		wait(cooldown)
		db = false 
	end
end)

game.PlayerAdded:Connect(function(player)
	game.Players.LocalPlayer.Chatted:Connect(function(msg)
		local spell = string.lower(msg)
		if spell == #spells then
			activeSpell = spell
		end
	end)
end)
-- if any future stats
--[[ tool.Activated:Connect(function()
	if mpc == 0 then
		mpc = mpc + 1
	end
	if estore == 0 then
		estore = estore + 20
	end
	if cooldown == 0 then
		cooldown = cooldown + 1
	end
end) ]]

2 comments

0

Animations in studio can only be seen by the owner of the animation, and ingame it only plays if the animation is owned by the game owner, I'm guessing that's your issue

0

Answered by this kind man. ^

1 answer

Hmm,

I haved problem before but I fixed that with Stopped all tracks in character and then playing animation or it can be issue as said Glacitron

for _,s in pairs(Character.Humanoid:GetPlayingAnimationTracks()) do
s:Stop()
end

local load = Character.Humanoid:LoadAnimation(animation)
load:Play()

This discussion is preserved as it was. New answers, comments, and votes are closed.