-
What do you want to achieve? Keep it simple and clear!
Hi there, is there any way to tween a gui from a start place to an end. I know this is entirely possible
using values for position, but how would I do it without having to do that. e.g have a tween run from one frame to another. -
What is the issue? Include screenshots / videos if possible!
I’m unsure on how to tween it without the use of position values. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Couldn’t find anything on how to do this.
Basically, I’m trying to tween a frame to another frame, without saying Udim2.new, etc. I know this is
probably has a easy solution, but any help would be greatly appreciated! Thanks
Here is my absolute awful coding – as a bonus it would be really helpful if you can point out ways to make the code more efficient and optimisable. Of course it’s not required.
-- local tweenservice = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local Frame = script.Parent.Parent.Parent:WaitForChild("Frame")
local TrophyFrame = script.Parent.Parent:WaitForChild("Trophies")
local TrophyIndicator = script.Parent:WaitForChild("TrophyIndicator") -- This is the frame that changes position upon trophy amount
-- Also the frame that is used for tweening.
local TrophyLabel = script.Parent.Parent:WaitForChild("TrophyLabel")
-- Trophies
local Beginner = script.Parent:WaitForChild("BeginnerLeague")
local Bronze = script.Parent:WaitForChild("BronzeLeague")
local Silver = script.Parent:WaitForChild("SilverLeague")
local Gold = script.Parent:WaitForChild("GoldLeague")
local Adamant = script.Parent:WaitForChild("AdamantLeague")
local Ruby = script.Parent:WaitForChild("RubyLeague")
local Diamond = script.Parent:WaitForChild("DiamondLeague")
local Mythical = script.Parent:WaitForChild("MythicalLeague")
while wait() do
if player.leaderstats.Trophies.Value == 100 or player.leaderstats.Trophies.Value < 249 then
print("Beginner reached")
TrophyIndicator.Position = Beginner.Position - UDim2.new(0,0,-0.35,0)
-- The code above is what I'm trying to tween from position 'A' to position 'B', without having to use values.
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Beginner League!"
else
if player.leaderstats.Trophies.Value == 250 or player.leaderstats.Trophies.Value < 499 then
print("Bronze reached")
TrophyIndicator.Position = Bronze.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Bronze League!"
else
if player.leaderstats.Trophies.Value == 500 or player.leaderstats.Trophies.Value < 999 then
print("Silver reached")
TrophyIndicator.Position = Silver.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Silver League!"
else
if player.leaderstats.Trophies.Value == 1000 or player.leaderstats.Trophies.Value < 1499 then
print("Gold reached")
TrophyIndicator.Position = Gold.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Gold League!"
else
if player.leaderstats.Trophies.Value == 1500 and player.leaderstats.Trophies.Value < 1999 then
print("Admant reached")
TrophyIndicator.Position = Adamant.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Adamant League!"
else
if player.leaderstats.Trophies.Value == 2000 and player.leaderstats.Trophies.Value < 2499 then
print("Ruby reached")
TrophyIndicator.Position = Ruby.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Ruby League!"
else
if player.leaderstats.Trophies.Value == 2500 and player.leaderstats.Trophies.Value < 2999 then
print("Diamond reached")
TrophyIndicator.Position = Diamond.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Diamond League!"
else
if player.leaderstats.Trophies.Value >= 3000 then
print("Mythical reached")
TrophyIndicator.Position = Mythical.Position - UDim2.new(0,0,-0.35,0)
TrophyIndicator.AnchorPoint = Vector2.new(0,0,0.5,0)
TrophyIndicator.Visible = true
TrophyLabel.Text = "Congratulations, you are in Mythical League!"
end
end
end
end
end
end
end
end
end