So for reference this is probably my first bit of code I've done myself, and I'm proud of the results but I feel like the code itself needs some work, is there a better way for me to use TweenService without creating a bunch of different variables for every UI element?
Or is there anything I should change that would be good practice for the future? Is there anything I did that's in bad practice and I should change?
The LocalScript and result of the code below:
https://medal.tv/games/roblox/clips/lZJAtxKojtiOWS9Xt?invite=cr-MSx6R2IsNTI2NDU4NDA2&v=14
local chains = button:WaitForChild("ChainsStart")
local title = button.Parent.Title
local stroke = button.Parent.Title:WaitForChild("UIStroke")
local background = button.Parent.Parent:WaitForChild("Primary")
local outer = background.Outer
local rotationSpeed = 20
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
outer.Visible = false
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local strokeGoal = {
Transparency = 1
}
local buttonGoal = {
BackgroundTransparency = 1,
TextTransparency = 1
}
local chainsGoal = {
ImageTransparency = 1
}
local titleGoal = {
TextTransparency = 1
}
local buttonFade = TweenService:Create(button, tweenInfo, buttonGoal)
local chainsFade = TweenService:Create(chains, tweenInfo, chainsGoal)
local titleFade = TweenService:Create(title, tweenInfo, titleGoal)
local strokeFade = TweenService:Create(stroke, tweenInfo, strokeGoal)
RunService.RenderStepped:Connect(function(deltaTime)
chains.Rotation = chains.Rotation + (rotationSpeed * deltaTime)
end)
button.MouseButton1Click:Connect(function()
rotationSpeed = 1440
buttonFade:Play()
chainsFade:Play()
titleFade:Play()
strokeFade:Play()
task.wait(1)
button.Parent.Enabled = false
outer.Visible = true
end)
Watch Untitled by rloe and millions of other Roblox videos on Medal. #roblox