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

Voice Activated Lighting Script Issues?

So I'm trying to make it so when I chat a certain number, it changes the lighting, but when I do it does nothing. I know the script works, it's just this part:


		game.Lighting.Ambient = 169, 164, 155
		game.Lighting.Brightness = 2
		game.Lighting.OutdoorAmbient = 169, 151, 43
		game.Lighting.ShadowSoftness = 0.5
		game.Lighting.ClockTime = -16.001
		game.Lighting.GeographicLatitude = 52.692
		game.Lighting.FogColor = 121, 75, 35

Full Script if you Need it:

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name) 
msg = string.lower(msg)

	if (msg == "/e 123984398450954") then 
		game.Lighting.Ambient = 169, 164, 155
		game.Lighting.Brightness = 2
		game.Lighting.OutdoorAmbient = 169, 151, 43
		game.Lighting.ShadowSoftness = 0.5
		game.Lighting.ClockTime = -16.001
		game.Lighting.GeographicLatitude = 52.692
		game.Lighting.FogColor = 121, 75, 35
	end 

end 

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered)

1 comment

0

You cant just type in numbers for Ambient, OutdoorAmbient and FogColor.. you need to use a Color3.new().

1 answer

✓ Accepted answer

Alright so the main issue I see is you aren't using Color3.new() and Clock time only goes to the nearest hour such as between 1 & 24. Here's a video ROBLOX did to explain TimeOfDay. I'd recommend watching it so you understand more of it.

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name) 
msg = string.lower(msg)

    if (msg == "/e 123984398450954") then 
        game.Lighting.Ambient = Color3.new(169, 164, 155)
        game.Lighting.Brightness = 2
        game.Lighting.OutdoorAmbient = Color3.new(169, 151, 43)
        game.Lighting.ShadowSoftness = 0.5
        game.Lighting.ClockTime = 16
        game.Lighting.GeographicLatitude = 52.692
        game.Lighting.FogColor = Color3.new.(121, 75, 35)
	game.Lighting.FogEnd = 1500
    end 

end 

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered)

Tell me if this works, apologies.. on my phone right now so I can't test it.

2 comments

0

Yes, it worked, thank you.

0

Yup

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