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

LocalScript Issue: The local script works in studio, but not in-game?

Asked by 7 years ago

I know for a fact this is a 'LocalScript' issue, but I'm not quite sure how to adjust the script for it to function out of studio.

Here's the script:

001local RANGE = 240
002local TIMESTEP = 1 / 30
003local SECONDS_BETWEEN_RECONSTRUCTION = 3
004local MAX_DIST_RATIO = 0.84
005 
006 
007-- Waits for parent.child to exist, then returns it
008local function WaitForChild(parent, childName)
009    assert(parent, "ERROR: WaitForChild: parent is nil")
010    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
011    return parent[childName]
012end
013 
014-----------------
015--| Variables |--
View all 148 lines...

It's a LocalScript inside a ScreenGUI that's in the StarterGUI. The ScreenGUI also has a frame with ImageLabels in it.

1 answer

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

Hi there,

In studio, local scripts work just like normal server scripts, thus, a local script in studio testing would be able to access all the services that would usually only be accessed on a normal server script in game. In your script, you used local Radar = WaitForChild(Workspace, 'Radar') which can only be accessed by a server script. I do suggest you use a remote event for server sided services. You may also want to check to ensure that your script does not access or edit any server sided services.

Your game is filtering enabled. And that’s a good thing! It prevents hackers from accessing the server and changing the properties of the server services. However, that creates some barriers such as stopping server to client communication. If your local script is to get anything other than what it can access in game, it will not work. You may want to check out remote events if you have not read about it: http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions

0
Right! Thank you! sactman64 7 — 7y
0
You're welcome! AbandonedRick 112 — 7y
Ad

Answer this question