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

OutdoorAmbient Script Won't Work? [SIMPLE]

GUYS, SERIOUSLY STOP GIVING ME -1s ON ALL MY POSTS!

b = script.Parent.Shop.setf.sanity.OFF
tcb = true
function c()
	if tcb == true then
		game.Lighting.OutdoorAmbient = Color3.new(147,147,147)
	end
end
b.MouseButton1Down:connect(c)

I did Color3.new, but script still doesn't work. And, also, I can't use the dev console, so I made one myself and I found this error: C:/Users/R****/AppData/Local/Roblox/Versions/version-71b693:172: attempt to index local 'RbxGui' (a nil value) and Error loading core script StarterScript

4 comments

1

That error in output is an error in the CoreGuis, it's not related to your script. I don't see any problems with your code off the bat. Can you add a print statement inside the c function to verify that it's actually being called?

0

Well, I've tested the script many times and found that the ambient would not change. And please clarify what print statement means... does it mean print('print')?

0

Wait... never mind XD. But seriously, is my studio outdated or something?

0

Yeah guys, this is a very good question, and people run into this problem a lot. Please stop downvoting it.

2 answers

✓ Accepted answer

The Color3 constructor takes numbers from 0 to 1. You have to divide each number by 255 in order for it to work.

game.Lighting.OutdoorAmbient = Color3.new(147/255,147/255,147/255)

You have to divide it by 255

b = script.Parent.Shop.setf.sanity.OFF
tcb = true
function c()
    if tcb == true then
        game.Lighting.OutdoorAmbient = Color3.new(147/255,147/255,147/255)
    end
end
b.MouseButton1Down:connect(c)

1 comment

0

I've figured it out already. Thanks anyways.

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