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

Why Can't Other Players See My Animations?

I've created an NPC and coded a script (not a localscript) and whenever I press test or Team test, I can see the animation clearly while my friend does not see the animation on the NPC at all, why could this be happening? I put it on a dummy on the workspace, and inside that dummy, I inserted a script and inside that, I inserted the Animation ID. Down below is the code I am using but only I can see it, can anyone help me out with this? I am also very new to coding so Im sorry!

local animation = script:WaitForChild('Animation')

local humanoid = script.Parent:WaitForChild('Humanoid')

local dance = humanoid:LoadAnimation(animation)

dance:Play()

2 answers

I recommend adding a StringValue to set it to "Idle" and put it in the NPC I'll give you an example of the type of code that I used for my script for my NPCs

local Animation = script.Parent:WaitForChild("Animation")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local AnimationPlay = Humanoid:LoadAnimation(Animation)

function Anim()
	if script.Parent.Stance.Value == "Idle" then
		AnimationPlay:Stop()
		wait(0)
		AnimationPlay:Play()
	end
end
Anim()

8 comments

0

Oh, Thanks so much, Im really sorry but Im new to the community and coding, what is a string value?

0

Also how would I change mine?

0

I tried copying yours exactly but it didn't work

0

Go to https://developer.roblox.com/en-us/api-reference/class/StringValue and then hover your mouse over the NPC in the workspace and click the + button and search stringvalue and click it and then name it to "Stance"

0

It still won't work and I also am confused about StringValue, Im so sorry but I really appreciate your help!

0

Wait, wait, wait. Does your NPC have a Humanoid?

0

Yes it does

0

Well i dont know then.

Thats the problem, Ur script is perfectly fine if u can see it, Except its a serverside script and animations are held by the local scripts, If u set the animation script to a local script it should work

4 comments

0

I tried that but it didn't work but all I did was move my code into a local script, was I supposed to do that?

0

Huh then i dont know Sorry m8 i am just very confused at this also

0

If you have your LocalScript in ServerScriptService then you need to put it in the NPC and change the script a bit to fit Workspace.

0

My local script is already in the NPC, could you possibly elaborate or tell me, the coding language is too confusing and Im new, sorry!

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