Script disable not working

In output it says, ServerScriptService.Scripts.MainScript:479: attempt to index nil with ‘Disabled’

outside, scroll up so you can see rain script and main script

for whatever reason the script thinks that There is no PlayerScripts in the player :confused:

1 Like

:frowning_face: looks like my story game will not be publish

Btw here is picture:

You can’t disable starterplayer scripts server-sided due to this.

The starterplayer is created locally.
your best option is remote events.

2 Likes

@paetemc2 maybe this will help

1 Like

On your main script (serversided) try this

game.ReplicatedStorage.Event:FireAllClients() -- replace "Event" with any remote event that server can access.

and your localscript do this (make sure its in starterplayerscript, optional btw)

game.ReplicatedStorage.Event.OnClientEvent:Connect(function()
	script.Parent.RainScript.Disabled = false
end)
1 Like

Each player’s ‘PlayerScripts’ container isn’t replicated to the server.

1 Like

If you want to stop the rain effect, require the module on the client and call the :Disable() method. To enable it again, use the :Enable() method.

This is described in the module’s documentation.

You’ll need to require and call the method on the client instead of on the server.

Please, make sure to read the documentation. The post above by @weakroblox35 should be unmarked as solution because it is plainly wrong usage for this library, and they could have known also if they read the documentation of the module.

disabling scripts don’t end them

They asked for a localscript to be disabled, i helped them, i see no mentions of a modulescript anywhere…?
Besides , it helped them disable the raineffect anyways.

The module pointed out in the thread (Rain Module + Plugin) has clear API documentation that can be used to achieve the intended effect of OP. Disabling the script instance that set up the rain is a bad and hacky solution in this context considering there is a very clear API available to enable/disable the rain effect through the library module itself.

In #help-and-feedback:scripting-support , it’s important to recognize when someone is posing an XY problem and guide them toward the better (simpler) solution. What the first poster is asking for may be due to a misunderstanding of how things work. It’s also part of the first poster’s fault for not doing due dilligence reading documentation and asking a badly posed question, FWIW.

Well i wasn’t really aware that it was a plugin, thanks for clarifying it out.