Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Voice Activated Lighting Script Issues?

Asked by 4 years ago

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)
0
You cant just type in numbers for Ambient, OutdoorAmbient and FogColor.. you need to use a Color3.new(). HeyItzDanniee 252 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

0
Yes, it worked, thank you. youngsavagehard 20 — 4y
0
Yup Just2Terrify 566 — 4y
Ad

Answer this question