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

Why Does My Localscript Only Work in Studio?

Asked by
Hexcede 52
8 years ago

Here is the erroring code that breaks the script:

animation = script.Parent.Whack -- Set this to the animation to use.

If I try to fix it then it just moves to the next line that uses script.Parent.something. The error only happens in online mode. The error is:

Whack is not a valid member of tool

I see no other errors unless I fix it. Any ideas on it?

0
If anyone wants to answer now would be great :) Hexcede 52 — 8y
0
say something please! Hexcede 52 — 8y
0
Anybody gonna even answer they don't know? Hexcede 52 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

Problem

The only problem I can see is that since it works in studio and not in server it should be a latency problem, this happens because in studio everything is pretty much local so you don't have to wait for a server to create stuff so your local scripts run instantly. In server this doesn't happen as when a local scripts cause upons something in player or character that is server-sided then the local script is "local" which makes it run faster then the server can respond.

Solution

repeat wait() until game.Players.LocalPlayer.Character--To the top of every local script
0
I am not using the character but I am using things inside the tool so should I apply this to the object within the tool? Hexcede 52 — 8y
0
yes! User#5978 25 — 8y
0
accept and +1 if it works User#5978 25 — 8y
0
I set up a print function after it. I get no output and no errors. Do you have another idea? Hexcede 52 — 8y
View all comments (2 more)
0
nope no idea. User#5978 25 — 8y
0
My idea has been some temporary server to client error or glitch or possibly something to do with clients themselves. Hexcede 52 — 8y
Ad

Answer this question