Below, I have provided a LocalScript that's a child of a gun. I have already defined "Gun". The parts that I have in bold (or astericks) is where the Tweening takes place. When the weapon's equipped, the three things tween into the screen as you can see, but when you unequip it and re-equip it too fast, some text doesn't make it up on time or it doesn't go in the right order. It looks glitchy. Also, in the ChildRemoved section, under the TweenPosition, it has a wait(). I did that to clear the text AFTER the Tween has finished but apparently it doesn't work. It may have something to do with the Override function in TweenPosition but I barely have any clue what that is. How can I change that as well?
Could anyone suggest a good way to fix and improve this to make Tweening more efficient?
I will greatly appreciate it. Thank you!
character.ChildAdded:connect(function(child)
if child:IsA("Tool") then
tool = child
if tool:FindFirstChild("Stats") then
local stats = tool.Stats
clipSize = stats.ClipSize.Value
fireRate = stats.FireRate.Value
reloadTime = stats.ReloadTime.Value
damage = stats.Damage.Value
spread = stats.Spread.Value
range = stats.Range.Value
ammo = tool.Ammo.Value
Gun:WaitForChild("Ammo").Text = ammo
Gun:WaitForChild("Name").Text = tool.Name
if tool.Stats.Automatic.Value == false then
Gun.Mode.Text = "SEMI"
else
Gun.Mode.Text = "AUTO"
end
if stats:FindFirstChild("Burst") then
burst = stats.Burst.Value
Gun.Mode.Text = "BURST"
else
burst = nil
end
**Gun:WaitForChild("Name"):TweenPosition(UDim2.new(0,92,0,6),"Out","Sine",.4)
Gun.Ammo:TweenPosition(UDim2.new(0,100,0,6),"Out","Sine",.56,false)
Gun.Mode:TweenPosition(UDim2.new(0,100,0,33),"Out","Sine",.58,false)**
end
character.ChildRemoved:connect(function(tool)
if tool:IsA("Tool") then
if tool:FindFirstChild("Stats") then
equip:disconnect()
reloading = false
if tool:FindFirstChild("Ammo") then
tool.Ammo.Value = ammo
end
**Gun:WaitForChild("Name"):TweenPosition(UDim2.new(0,290,0,6),"Out","Sine",.4)
Gun.Ammo:TweenPosition(UDim2.new(0,298,0,6),"Out","Sine",.56,false)
Gun.Mode:TweenPosition(UDim2.new(0,298,0,33),"Out","Sine",.584,false)
wait()
Gun:WaitForChild("Name").Text = ""
Gun.Ammo.Text = ""
Gun.Mode.Text = ""**
if body.LeftArm and body.RightArm and body.Torso and body.LeftShoulder and body.RightShoulder then
if atease then
AtEase()
end
body.LeftShoulder.Part1 = body.LeftArm
body.RightShoulder.Part1 = body.RightArm
leftWeld.Parent = nil
rightWeld.Parent = nil
end
mouseDown = false
deathCon:disconnect()
hitSound.Parent = nil
equipped = false
end
end
end)
HasEq=false
GunEquip=function(GunName)
if not HasEq then
local g=Plr.Backpack:findFirstChild(GunName)
if g then g.Parent=Plr.Character
HasEq=true
end
else
local gg=Plr.Character:findFirstChild(GunName)
if gg then gg.Parent=Plr.Backpack
HasEq=false
end
end
end

2 comments
Set the 'override' argument as true for all of the TweenPositions (it's the boolean one). This will allow you to stop/change a tween mid-tween (with other TweenPositions) meaning that the behaviour you're currently seeing won't occur.
Ahhh. Got it. Thank you.