i want to make a gui repeatedly become bigger and smaller idk how to use tween:
while true do
local info = TweenInfo.new(Enum.EasingStyle.Exponential)
script.Parent.Size = UDim2.new({0, 400},{0, 50}, info , {0, 500},{0, 70}, info)
end
i want to make a gui repeatedly become bigger and smaller idk how to use tween:
while true do
local info = TweenInfo.new(Enum.EasingStyle.Exponential)
script.Parent.Size = UDim2.new({0, 400},{0, 50}, info , {0, 500},{0, 70}, info)
end
I recommending looking at documentation the example code there could be quite helpful in seeing if your going in the right direction or not GuiObject | Roblox Creator Documentation
Also I recommend running the code you place in a loop outside of it just to verify if it works.
then also adding a wait so your script doesn’t time out (or crash your game/studio).
Use it just how you tween parts!
Heres an example:
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(5, Enum.EasingStyle.Linear) -- 5 is the time and there are a few more parameters to it, which you can view in the official docs
local TweenToPlay = TweenService:Create(guiInstance, info, { Position = UDim2.new(1,0,1,0) }) -- example to tween gui position.
TweenToPlay:Play()
what do you mean by guiInstance
Read the following article on what an Instance is: Instance | Roblox Creator Documentation
for your script replace guiInstance with script.Parent
In other words, guiInstance is the frame/button/any other gui that has the LocalScript.
ok but how would i make the gui become bigger and smaller repeatedly i tried but i did not work:
local TweenService = game:GetService("TweenService") local info = TweenInfo.new(5, Enum.EasingStyle.Exponential) while true do local TweenToPlay = TweenService:Create(script.Parent, info, { Size = UDim2.new(0, 500,0, 70) }) TweenToPlay:Play() wait(.1) local TweenToPlay2 = TweenService:Create(script.Parent, info, { Size = UDim2.new(0, 400,0, 50) }) TweenToPlay2:Play() end
Try this, also you might want to learn more about tweening to get your concepts to be clearer.
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(5, Enum.EasingStyle.Exponential)
local play = true
function tween()
if not play then
return
end
play = false
local TweenToPlay = TweenService:Create(script.Parent, info, { Size = UDim2.new(0, 500,0, 70) })
TweenToPlay:Play()
TweenToPlay.Completed:Wait()
local TweenToPlay2 = TweenService:Create(script.Parent, info, { Size = UDim2.new(0, 400,0, 50) })
TweenToPlay2:Play()
TweenToPlay2.Completed:Wait()
play = true
tween()
-- If you want to stop this from calling the function, just put a condition you desire or a condition that fits the working of your game
end
tween()
This prevents Tweens from overlapping each other!