Scripts no longer working?

I was working on the Sanity system for my Backrooms game, when all of a sudden all of my scripts which run passively stopped working completely. They aren’t completely broken as I can still manually run functions however the 2 while loops that run, one for lights and one for sanity, have completely stopped working. They both worked previously. Restarting studio did not change a thing. The sanity script also for some reason returns this error:


Here’s the area of the script where this error occurs:

local Sanity = script.Sanity
print("Sanity got")
Sanity.Value = 100
print("Sanity set")
local maxSanity = script.maxSanity
print("Max sanity got")
local player = game:GetService("Players").LocalPlayer
print("Player got")
local human = player.Character:WaitForChild("Humanoid")
print("Humanoid got")

Update: for some reason when I playtest, all scripts in ServerScriptService disappear. This seems to be the cause of the problem. Anyone know why this happens?

maybe you were scripting when your playtest was running :man_shrugging:

local char = player.Character or player.CharacterAdded:Wait()
local human = char:WaitforChild("Humanoid")

Nope, 100% certain it’s definitely not that.

Now the error it returns is this:

This is a local script - right?

serverscriptservice Is a Server-side handler, when pressing Play, you automatically run as a Client. Client’s don’t have access to this handler, much like a ServerScript doesn’t have access to any Client-side handlers, this is why you cannot see anything. ROBLOX added a button that allows you to switch between Server and Client, click it to switch and you should then see all of your Scripts.

Yep, the Sanity manager is a local script and the light manager is a regular script.

Are you trying to get light manager from a local script because if so local scripts can’t look in server storage or server script service

Ah, figured it out. Just needed to move the number value to workspace.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.