Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Can't Other Players See My Animations?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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()
0
Oh, Thanks so much, Im really sorry but Im new to the community and coding, what is a string value? BetterKelvinater 3 — 4y
0
Also how would I change mine? BetterKelvinater 3 — 4y
0
I tried copying yours exactly but it didn't work BetterKelvinater 3 — 4y
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" Zendex32 -2 — 4y
View all comments (4 more)
0
It still won't work and I also am confused about StringValue, Im so sorry but I really appreciate your help! BetterKelvinater 3 — 4y
0
Wait, wait, wait. Does your NPC have a Humanoid? Zendex32 -2 — 4y
0
Yes it does BetterKelvinater 3 — 4y
0
Well i dont know then. Zendex32 -2 — 4y
Ad
Log in to vote
0
Answered by
TNTIsLyfe 152
4 years ago

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

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? BetterKelvinater 3 — 4y
0
Huh then i dont know Sorry m8 i am just very confused at this also TNTIsLyfe 152 — 4y
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. emervise 123 — 4y
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! BetterKelvinater 3 — 4y

Answer this question