Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

OutdoorAmbient changes to 4080, 4080, 3825 when this script is activated, How do I fix it?

So I'm making a script where when you touch a part, everything gets all dark and spoopy. But the problem is, when you touch the part, the OutdoorAmbient changes to 4080, 4080, 3825 and the FogColor changes to 4335, 0, 0. Can anyone help me figure out why it does this? Thanks!

Script:

local tohandout = game.ReplicatedStorage:WaitForChild("Static"):Clone()
local players = game.Players.LocalPlayer

function onTouched(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		print("Found the humanoid")
		for _,players in pairs (game.Players:GetPlayers()) do
		if players then	
		tohandout.Parent = players:WaitForChild ("PlayerGui")
        game.Lighting.TimeOfDay = "03:00:00"
		game.Lighting.OutdoorAmbient = Color3.new(16, 16, 15)
		game.Lighting.FogEnd = 200
		game.Lighting.FogColor = Color3.new(17, 0, 0)
		game.ReplicatedStorage.GreenSpace:Clone().Parent = game.Lighting
		print("Scary Scare Completed")		
		script.Parent:Remove()
	end
		end
		end
		end

script.Parent.Touched:connect(onTouched)

1 comment

1

When using a Color3, you need to ensure that you are dividing by 255. So, game.Lighting.OutdoorAmbient = Color3.new(16/255, 16/255, 16/255) as well as game.Lighting.FogColor = Color3.new(17/255, 0, 0)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.