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?
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.