Errors in console

So I have received an error in my console, which I can’t seem to fix. I have tried to move everything under ServerScriptService, however errors are still returned.

https://gyazo.com/b6f850cb7056f017320fbd681fee2147

Ignore the second error returned, as I’m not focusing on that as of now.

Any form of help would be appreciated.

The error occurs because you attempt to get the Settings child of ServerScriptService, but, at the time of the attempt, there is no child named Settings.

I moved everything under SSS, but the errors still remains.

Should I place the LinkedLeaderboard under the Settings tab in SSS, as seen in the screenshot.

To avoid the error you need to place the instance named Settings under ServerScriptService. If the error persists, ensure that it is not being re-parented to another location.

This is not necessary.

The error still persists and I’m not entirely sure how to check if Settings is being re-parented?

https://gyazo.com/63e60ce9214d3fa66dda0d11a8dcdc51

https://gyazo.com/a6cbb8f6096de44611b6a9e1a9c1ba6d

Segments from Studio.

https://gyazo.com/63e60ce9214d3fa66dda0d11a8dcdc51 Is this fine?

Which script is that in? If it is one of those scripts under ServerScriptService then it should be fine, but then why are you updating the parent to ServerScriptService when it is already under ServerScriptService?

You should not use this syntax unless the members you’re indexing have spaces in their names.

You should try using script.Parent:WaitForChild("Settings") instead, because it’s possible the script is running before the instances you’re indexing have loaded into the game.

1 Like

What? That’s fundamentally not true. You should only use that syntax if you cannot index the child normally. You should use :FindFirstChild if you’re not certain a child exists.

1 Like

There is no difference,

local h = script.H
-- is the same thing as
local h = script["H"]
-- or even
local h = getfenv()["script"]["H"]
1 Like

WaitForChild is not restricted anywhere. There are cases on the server where it is required.

1 Like

The purpose of WaitForChild is for getting instances which you can’t guarantee exist when the script runs. (LocalScripts in ReplicatedFirst)

This isn’t only useful on the client though, you may create some instances on the server which you will have to wait for. (especially with tools being cloned into a player’s backpack)

Please list the many ways the dot syntax is unreliable.

2 Likes

This is getting off topic. As a courtesy to the OP I would suggest we stop.

The issue is that there’s no child named Settings or Minigun in SeverScriptStorage. Are there in fact Instances by those names in SSS, @supercool2002? If so there may be problems with your code.

@supercool2002 The solution is to swap these two lines if the script isn’t already in ServerScriptService.

image

It’s recommended to use game:GetService("ServerScriptService") instead of indexing it directly.

Don’t bother changing how you index things. You don’t need to use thing["child"] unless the name of the child produces invalid lua.


This thread is being derailed.

2 Likes

Alright, I’ll will take a look soon. Don’t delete this thread as I’ll be reading everyone’s responses

It was previously in workspace, which is fine (still is?) because the script accounts for where the parent is located?

If this is true, then it was trying to get an object named “Settings” under workspace. You never showed us the full explorer, so we had to assumed it was one of those scripts under ServerScriptService. The script should be moved so it is correctly getting the module for Settings.