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

Why won't my script work on a public server?

Asked by
Stravan 18
7 years ago
Edited 7 years ago

I'm now having troubles as to why this won't work in a public server. This script only works in studio and I don't really know why.

wait(.5)
id = "http://www.roblox.com/asset/?id=549955265"
Example = script.Parent.Parent
Animation = script:WaitForChild("Animation")
Animation.AnimationId = id
local animationTrack = Example.Humanoid:LoadAnimation(Animation)
animationTrack:Play()

Some of you guys might recognize this script from the last question I asked, and I did solve that problem.. however I never realized it didn't work on a public server up until now. I have FilteringEnabled on in case that makes a difference with this script. I'm using an R15 rig, but I know that's not the reason why it's not working because an R6 rig doesn't work either with this script. Every other question related to this topic all points to using FindFirstChild or WaitForChild and I'm using WaitForChild so I don't really know what to do.

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Ensure that this is in a localscript, as that is the only way animations can be used.

I also recommend taking a look at this blog post:

https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online

0
I thought I wasn't supposed to use a LocalScript from the wiki. I did try that though, nothing changed. Stravan 18 — 7y
0
Did you try reading the blog post? Also animations only work in LocalScripts. antonio6643 426 — 7y
0
Are you sure? And yes I did read the blog post. Whenever I used a localscript as you said, the script wouldn't even work when I hit "Play" instead of start sever. EDIT: I realized I forgot to tell you I'm animating an NPC, if that's why you think I shouldn't be using a localscript. Stravan 18 — 7y
0
I figured out why it didn't work! And yes, you were right. I needed to use a localscript. Thank you! Stravan 18 — 7y
Ad
Log in to vote
0
Answered by
Stravan 18
7 years ago

I managed to figure out why this wasn't working! I didn't fully understand the differences between a ServerScript and a LocalScript, and all I knew was that one ran on the client's side, and one ran on the server side.

Anyway, I didn't know LocalScripts couldn't run in Workspace, so literally all I had to do was move it to StarterPack and reroute a few variables. Thank you to everyone who tried to help me!

Answer this question