I’m creating a Tween editor plugin and i use a ModuleScript for information about keyframes.
I’m not sure if there is a way to add a table to a ModuleScripts’ source without deleting what was there
and change variable info like Position and Time.
I haven’t tried anything because i don’t know how to Add to a ModuleScript at all.
What i want to achieve in ModuleScript
local Tweens = {
["Tween1"] = {
DefaultPos = UDim2.new(),
TweenPos = UDim2.new(),
Length = 1,
EasingStyle = "Quad",
},
["Tween2"] = {
DefaultPos = UDim2.new(),
TweenPos = UDim2.new(),
Length = 3,
EasingStyle = "Sine",
},
}
return Tweens
Plugin Script
defaultPos.MouseButton1Up:Connect(function()
local Selected = SelectionService:Get()[1]
if Selected then
local Animator = QuickFunc.GetAnimator(Selected)
Animator.Source = Animator.Source:gsub("DefaultPos = UDim2.new()[^\n]*\n", ("DefaultPos = UDim2.new(%s, %s, %s, %s)\n"):format(Selected.Position.X.Scale, Selected.Position.X.Offset, Selected.Position.Y.Scale, Selected.Position.Y.Offset))
print("Success", "Def pos")
end
end)
tweenPos.MouseButton1Up:Connect(function()
local Selected = SelectionService:Get()[1]
if Selected then
local Animator = QuickFunc.GetAnimator(Selected)
Animator.Source = Animator.Source:gsub("TweenPos = UDim2.new()[^\n]*\n", ("TweenPos = UDim2.new(%s, %s, %s, %s)\n"):format(Selected.Position.X.Scale, Selected.Position.X.Offset, Selected.Position.Y.Scale, Selected.Position.Y.Offset))
print("Success", "Out pos")
end
end)
Hoping someone can help me in the right direction or give me some info on how to go about adding to a ModuleScripts’ source. Thank you.