ok so this relates to my last post, now that I got a theme system that changes themes, how do I tween it so it changes more smoothly?
I know I could try just tweening the background color, but then the text color will be ignored. if I add in a text color, I’ll have to add a check to make sure that the thing is a text button or label. then I would have to do a check for if it’s tweening just the text, just the background, or both. and finally, what if I decide I want to change font, font size, rotation, etc? right now it’s easy and it can do all that, but if I add in tweening it gets a lot more difficult, and so far it only results in an error. this is the code I have to help try to understand what I’m doing and how I’m doing it to get more effective help.
--script written by IVoidstarI, edited by rankydoodle
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local themes = ReplicatedStorage.Themes
local theme = script.Theme.Value
local uiOverrides = theme.UIOverrides
local uiColors = theme.Colors
local currentTheme
local currentGui
local function ApplyTheme(currentTheme : Folder, currentGui : GuiObject)
for _, child in pairs(currentTheme:GetChildren()) do
if child:IsA("Folder") then
ApplyTheme(child, currentGui[child.Name])
elseif child:IsA("ValueBase") then
local colorName = child.Value
local colorValue = uiColors[colorName].Value
currentGui[child.Name] = colorValue
end
end
for i, v in pairs(playerGui:GetChildren()) do
if v.Name == "Colors" then
--print("Colors Folder Found, Destroying")
v:Destroy()
end
end
local CuiColors = uiColors:Clone()
CuiColors.Parent = playerGui
end
ApplyTheme(uiOverrides, playerGui)
script.Theme.Changed:Connect(function()
--print("Theme Change!")
theme = script.Theme.Value
uiOverrides = theme.UIOverrides
uiColors = theme.Colors
ApplyTheme(uiOverrides, playerGui)
end)
if I try to do something like
TweenService:Create(currentGui, TweenFunction, {currentGui[child.Name] = colorValue}):Play()
within the part that applies the theme it gives me an error stating “unable to cast to dictionary.” is there anything that I can try?