#why does this local script keep giving me trouble?

1 messages · Page 1 of 1 (latest)

gritty zealot
#

like 300 reworks and it keeps finding ways to not work it works in studio but it refuses to sometimes work in game
why would that ever be a thing?????

#

i know someones gonna say "i can't help you without the code"

local Ambience = Replicated["Eerie Ambience 1 (SFX)"].SoundId
local Music = Replicated.Sound.SoundId
local RemoteEvent = Replicated.WorkPlease

local BoolValue = script.Room


game.Lighting.TimeOfDay = 6.5 


-- sound
local ambience = Replicated:WaitForChild("Eerie Ambience 1 (SFX)")
local music = workspace:WaitForChild("Music")

local function onChanged(plr)
    if BoolValue.Value == true then
        game.Lighting.TimeOfDay = 12
        music.SoundId = Music
        music:Play()
    end

    if BoolValue.Value == false then
        game.Lighting.TimeOfDay = 6.5 
        music.SoundId = ambience.SoundId
        music:Play()
    end
    
    music:Play()
end

onChanged()
BoolValue.Changed:Connect(onChanged)```
here's the code, what could have i messed up to make it work in studio but not in game
#

is my game cursed?

tropic pasture
#

you can open the console in roblox game

#

check if there are any errors there

gritty ibex
#

Nvm

#

I dont think ur getting thr value of boolValue

#

Ur just getting the instance

#

Unless ur meant to do that

nova ravine
#

what do you mean by "refuses to sometimes work" is it erroring or just not working