Alright, and thank you for the time trying to help me out. I am new to using tables and looping through them but I’m sure your way would work too if I knew more about what I was doing lol.
yepa nd i take it back it did NOT work lol. It looked like it but I was changing the colors to see more clearly and realized it’s not working how I thought it did.
I will try his method again and see if I am doing it right and get back to yall!
Hey! So this did end up helping me find the solution. I created a “master” table where all the tweens that were created were stored and right before I played any tween, I would cancel any tweens in the master tween table. BUT I also had to add extra lines where I reset the tweened property because canceling the tweet did not reset it, idk why…
But yeah here is an example of how Button[2]
looks now!
local function createTween(Lights)
local Strobe = TweenService:Create(Lights, TweenInfo[3], {Transparency = 1})
table.insert(mastertweentable, Strobe) -- Save the tween in mastertweentable
Button[2].MouseButton1Click:Connect(function()
warn("Button 2 Pressed")
warn("Cancelling all tweens")
-- Cancel all tweens
for _, tween in ipairs(mastertweentable) do
tween:Cancel()
end
print("All Tweens Cancelled")
-- Reset all parts tagged with Bulbs[3]
for _, Lights in pairs(CollectionService:GetTagged(Bulbs[3])) do
Lights.Transparency = 0
end
print("All Parts Reset")
Strobe:Play()
print("Strobe Playing")
end)
end
- It cancels any tweens inside the master tween table.
- Resets all the part’s transparency to 0.
- Plays the new tweens on the parts.
Thank you and @2112Jay for the help!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.