Hello. I’m scripting a light script that will on command /lights turn off or turn on lights
I tween color3 of parts
Script:
local Lights = true
local Config = require(script.Configuration)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "/lights" then
if Config.CheckGroupRank == true then
local PlayerRank = plr:GetRankInGroup(Config.GroupId)
if PlayerRank >= Config.MinGroupRank then
if Lights == true then
for _,light in pairs(game.Workspace.Lights:GetChildren()) do
local Tween = game:GetService("TweenService"):Create(light,TweenInfo.new(1.3,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{Color = Color3.new(0,0,0)})
Tween:Play()
end
Lights = false
elseif Lights == false then
for _,light in pairs(game.Workspace.Lights:GetChildren()) do
local Tween = game:GetService("TweenService"):Create(light,TweenInfo.new(1.3,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{Color = Color3.new(237, 234, 234)})
Tween:Play()
end
Lights = true
end
end
elseif Config.CheckGroupRank == false then
if Lights == true then
for _,light in pairs(game.Workspace.Lights:GetChildren()) do
local Tween = game:GetService("TweenService"):Create(light,TweenInfo.new(1.3,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{Color = Color3.new(0,0,0)})
Tween:Play()
end
Lights = false
elseif Lights == false then
for _,light in pairs(game.Workspace.Lights:GetChildren()) do
local Tween = game:GetService("TweenService"):Create(light,TweenInfo.new(1.3,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{Color = Color3.new(237, 234, 234)})
Tween:Play()
end
Lights = true
end
end
end
end)
end)
But this happen:
So I don’t know why it’s doing that
Thank for any help!