So I have this tweening script from a tutorial I watched and I wanted to make like a tween module or function so that I can just create a tween using whatever properties I have set in another module script, but I’m not really sure tbh how to do it.
workspace.FX.ChildAdded:Connect(function(Child)
if Child.Name == "CombatHit" then
local Mesh = Child:WaitForChild("Mesh")
local Info = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0)
local Goals = {Scale=Vector3.new(7,7,7)}
local tween = game:GetService("TweenService"):Create(Mesh,Info,Goals)
tween:Play()
local Mesh = Child:WaitForChild("Mesh")
local Info = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0)
local Goals = {Transparency = 1}
local tween = game:GetService("TweenService"):Create(Child,Info,Goals)
tween:Play()
elseif Child.Name == "CustomMeshFX" then
local Info = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0)
local Goals = {Transparency=1,Size=Vector3.new(10,10,10)}
local tween = game:GetService("TweenService"):Create(Child,Info,Goals)
tween:Play()
local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local Goals = {CFrame=Child.CFrame*CFrame.Angles(math.random(-90,30),math.random(-90,90),math.random(-90,90))}
local tween = game:GetService("TweenService"):Create(Child,Info,Goals)
tween:Play()
end
end)
I have a module script which is just a huge list of all the characters in my game and all of there moves and it kind of looks like this (for each move)
["EEE"] = {
--Properties
anim = 5564125079;
type = "projectile";
--fx
pfx = game.ServerStorage.FX.ParticleEmitter;
fx = game.ServerStorage.FX.CustomMeshFX;
color = Color3.fromRGB(0,0,0);
tween = "";
--Stats
speed = 50;
dmg = 25;
heal = 0;
kb = 0;
stun = 0;
height = 0;
};
So whenever the player hits EEE I’d like to get the stuff I have under fx to make a new tween or whatever. Hopefully this makes sense lol I’m not great with modules and making good code so yeah.