Alright so, the script below is suppose to be what happens when the RemoteEvent is fired. It's suppose to do a fade for Light Tweening between each color, so if Black is called, it tweens the lighting to be black and then it stays there... hence why there is no loop. This script is not working at all. I want it to get the current pointlight value and tween it to the new color and if that can't be done then where it fades out then into that color.
--Made By MillerrIAm--
---------------Variables---------------
ReplicatedStorage = game.ReplicatedStorage
tweenArenaLights = game.ReplicatedStorage.LightingEvents.TweenArenaLighting
local TweenService = game:GetService("TweenService")
TweenInform = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,100,false,1)
local children = game.Workspace.ArenaLights:GetChildren()
---------------Main Code---------------
tweenArenaLights.OnServerEvent:Connect(function(player,arenalight)
---------------Colors---------------
---------------Black & White---------------
if arenalight == "BrightWhite" then
for i, v in pairs(children) do
if v:FindFirstChild("PointLight") ~= nil then
TweenService:Create(v,TweenInform,{Color = Color3.fromRGB(255,255,255)})
end
end
wait(0.01)
elseif arenalight == "Blackout" then
for i, v in pairs(children) do
if v:FindFirstChild("PointLight") ~= nil then
TweenService:Create(v,TweenInform,{Color = Color3.fromRGB(0,0,0)})
end
end
wait(0.01)
end
end)
This is the GUI Button script that fires the event when clicked upon, I have one for Blackout and BrightWhite which is just a duplicate of Black and White. This works fine as i'm currently using it for other events inside the same folder.
function change()
game.ReplicatedStorage.LightingEvents.TweenArenaLighting:FireServer("BrightWhite")
end
script.Parent.MouseButton1Down:connect(change)
Thank you in advance for any comments, answers and help given! **Please use the Answer tab for comments as well! It makes it so I can reward you if your comment helps me figure this out and can help future scripters who may have a similar issue(s). **
