alright so this question seems pretty simple right? well i think im missing something here because in the past i used to just be able to insert a local script and have it change game lighting during a touched event but this has been about a year ago so Roblox has of course changed and now that for some reason doesnt work and so my final approach for solving the issue was doing the simple thing of using remote events so is set up my script Script:
local sound = "rbxassetid://2880683456"
local gui = script:WaitForChild("AreaTitle")
local event = script.Parent.Parent.ChangeLighting
script.Parent.Touched:Connect(function(hit)
if game.Players:findFirstChild(hit.Parent.Name) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.PlayMusic:FireClient(player,sound)
local CurrentArea = player:WaitForChild("CurrentArea")
if CurrentArea.Value ~= "Mystery Cave" then
CurrentArea.Value = "Mystery Cave"
event:FireClient(player)
if player.PlayerGui:FindFirstChild("AreaTitle") == nil then
local clone = gui:Clone()
clone.Parent = player.PlayerGui
clone.Script.Disabled = false
end
end
end
end)
and then i sauteed up my client side script LocalScript:
local l = game.Lighting
script.Parent.Parent.ChangeLighting.OnClientEvent:Connect(function()
l.Brightness = .1
l.Ambient = Color3.new(84/255, 15/255, 83/255)
l.OutdoorAmbient = Color3.new(186/255, 87/255, 206/255)
l.FogEnd = 550
l.FogStart = 100
l.FogColor = Color3.new(104/255, 30/255, 103/255)
l.ExposureCompensation = .43
end)
and bam before i knew i absolutely no results what so ever (welcome to Roblox) and beforehand i made sure i knew what i was typing and converted it over to server side just to make sure this chef had all his ingredients correct Script:
local l = game.Lighting
script.Parent.Touched:Connect(function(hit)
if game.Players:findFirstChild(hit.Parent.Name) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
script.Parent.Parent.Entered.Value = true
l.Brightness = .1
l.Ambient = Color3.new(84/255, 15/255, 83/255)
l.OutdoorAmbient = Color3.new(186/255, 87/255, 206/255)
l.FogEnd = 550
l.FogStart = 100
l.FogColor = Color3.new(104/255, 30/255, 103/255)
l.ExposureCompensation = .43
end
end)
and then everything worked exactly as it was supposed to just server sided so i know the script i'm writing here is correct, but what is its reasoning to not run? its kinda hard to debug localscripts when Roblox just decides to disable print,warn, and error functions from popping up in the console (unless i'm just on the funky part of town and messed with a game setting somewhere i didn't know about)

3 comments
Roblox doesn't have console disabled for local scripts. One possible reason why your script isn't doing anything is because you have it parented to someone that can't run scripts. Also, I don't think local scripts run when their are parented to ScreenGui's that have Enabled set to false.
Well, I wouldn't be putting a script like this under any GUI elements... why not just paretnt it to the Player's startup scripts instead?
Well, I wouldn't be putting a script like this under any GUI elements... why not just paretnt it to the Player's startup scripts instead?