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

Why doesn't my sword animation work when anybody but me uses the sword?

For some reason, my sword animation that I made only works on me. When I ask a friend to test it on their character, it doesn't function and in the output it says cannot load animation.

I used a local script for the animation and I put an animation item in the local script. The local script is:

local CanAttack = true

script.Parent.Activated:connect(function()
	local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
	
	if CanAttack == true then
		attack:Play()
		CanAttack = false
		wait(3)
		attack:Stop()
		CanAttack = true
		script.Parent.CanDamage.Value = true
	end
end)

(There is also a boolvalue in the sword tool set to true)

So could someone give me a solution, that would be much appreciated.

4 comments

0

Is Your Game Fe?

0

Yes

1

Did you have your friend test it by giving the tool to them as a model? If you did, then it won't work. Animations can only be used by its publisher.

0

It wasn't a model as the sword parts weren't grouped together. All the parts were in a tool item in replicated storage. To use the sword, you have to buy it from a shop and it appears in the users inventory and does damage, but the animation unfortunately doesn't work

1 answer

I'm no expert, but if you're using LocalScript, change it to Script ! LocalScripts work for player themselves, but Scripts work gamewide ! (You have rights to judge me, since I don't know it all completely)

2 comments

0

I've tried that before and again it doesn't work. It just comes up with the same error message :(

0

Alright, then I'm out of ideas,sorry...

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