I’ve been making my own Tween editor Gui for my own convenience.
My editor uses a similar way of getting a Default position and then a Tweened position like the TweenSequence Editor.
When i click Default pos button it’ll replace “local DefaultPos” with “local DefaultPos = UDim2.new(POS)”
Button Script
defaultPos.MouseButton1Up:Connect(function()
local Selected = SelectionService:Get()[1]
if Selected then
local Animator = QuickFunc.GetAnimator(Selected)
Animator.Source = Animator.Source:gsub("local DefaultPos", "local DefaultPos = UDim2.new("..Selected.Position.X.Scale ..", ".. Selected.Position.X.Offset ..", ".. Selected.Position.Y.Scale ..", ".. Selected.Position.Y.Offset ..")")
print("Success", "Def pos")
end
end)
QuickFunc Script
module.GetAnimator = function(obj)
local ModuleScript = obj:FindFirstChild("Animator")
if ModuleScript then
return ModuleScript
else
local _ModuleScript = script.Parent.Animator:Clone()
_ModuleScript.Parent = obj
return _ModuleScript
end
end
Animator Script
local KeyFrame = {
Play = function()
local DefaultPos
local OutPos
local Length
local EasingStyle = "Quad"
script.Parent.Position = DefaultPos
script.Parent:TweenPosition(OutPos, "Out", EasingStyle, Length)
wait(Length + 1)
script.Parent.Position = DefaultPos
end
}
return KeyFrame
If i want to update the Default pos it’s doing this:
Weird script
local KeyFrame = {
Play = function()
local DefaultPos = UDim2.new(0.89415556192398, 0, 0.45788159966469, 0) = UDim2.new(0.9539806842804, 0, 0.45788159966469, 0)
local OutPos
local Length
local EasingStyle = "Quad"
script.Parent.Position = DefaultPos
script.Parent:TweenPosition(OutPos, "Out", EasingStyle, Length)
wait(Length + 1)
script.Parent.Position = DefaultPos
end
}
return KeyFrame
I’m hoping someone can guide me to fixing this or point out something i should use instead of maybe gsub.
Thank you very much.