Hello, i want to turn the Bulbs in this Theater to black with Tweenservice. They are all in a Model and just one Part. I need some help Remembering again how to do this.
local clickdetector = script.Parent.ClickDetector
TweenService = game:GetService("TweenService")
info = TweenInfo.new(7,Enum.EasingStyle.Linear)
local S1 = game.Workspace.AudiBulbs:getChildren()
script.Parent.ClickDetector.MouseClick:Connect(function()
local goal = {}
goal.Color = Color3.fromRGB(0, 0, 0)
local tween1 = TweenService:Create(S1,info,goal)
tween1:Play()
end)
I want to adress all the Parts in the Model to be tweened. I know i did it before but i totally forgot how i did it and cant find the Script anymore on how.
I miss a Step for sure. Any help is appricated =)
It’s because the first argument you provided in the tween is a table, it needs to be an object/instance. Thus,you can loop through all the lights, and then provide its index.
Try this,
local clickdetector = script.Parent.ClickDetector
TweenService = game:GetService("TweenService")
info = TweenInfo.new(7,Enum.EasingStyle.Linear)
local S1= game.Workspace.AudiBulbs:getChildren()
script.Parent.ClickDetector.MouseClick:Connect(function()
local goal = {}
goal.Color = Color3.fromRGB(0, 0, 0)
for k = 1,#S1 do
local tween1 = TweenService:Create(S1[k],info,goal)
tween1:Play()
end
end)
local clickdetector = script.Parent.ClickDetector
local TweenService = game:GetService("TweenService")
info = TweenInfo.new(7,Enum.EasingStyle.Linear)
local S1 = game.Workspace.AudiBulbs:GetChildren() -- GetChildren returns a table of all the instances.
script.Parent.ClickDetector.MouseClick:Connect(function()
local goal = {}
goal.Color = Color3.fromRGB(0, 0, 0)
for i,part in pairs(S1) do -- Gets each part from the table
local tween1 = TweenService:Create(part,info,goal)
tween1:Play()
end
end)
Please mark the post that helped you as a solution so it will help the others to find the solution
and it will make other developers sure that this post have a solution.