I think the issue is the thing about I was saying about ordering.
Probably cause you are using task.wait() and you are playing the tween2 before to declare that when that tween completes perform a function.
The second time it runs, finally completed event is connected, thats the reason why the second time it actually completes.
You should declare the complete event before to play the tween:
local MarketplaceService = game:GetService("MarketplaceService")
local TweenService = game:GetService("TweenService")
local ServerStorage = game:GetService("ServerStorage")
local Debounce = false
CoolDown = script.Parent.Parent.CoolDown.CoolDown
local Shockwave = ServerStorage:WaitForChild("ShockWave")
local Leg = game.Workspace.TrollStompBoss.LeftLeg
local head = game.Workspace.TrollStompBoss.Head.Head
local ShockWaveinfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local goals = {
Size = Vector3.new(1.75, 194.5, 283.25),
Position = Vector3.new(1853.58, 14.396, -510.175)
}
local info2 = TweenInfo.new(0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, true, 0)
local info3 = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
local goals2 = {
Position = Vector3.new(1851.527, 28.998, -507.832)
}
local tween2 = TweenService:Create(Leg, info2, goals2)
local goals3 = {
Orientation = Vector3.new(24.46, -98.931, 1.936)
}
local goals4 = {
Orientation = Vector3.new(-25.514, -100.574, 1.953)
}
local tween3 = TweenService:Create(head, info3, goals3)
local tween4 = TweenService:Create(head, info3, goals4)
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 122099059) then
if Debounce == false then
CoolDown.Enabled = false
script.Parent.Color = Color3.new(1,0,0)
Debounce = true
tween3:Play()
tween3.Completed:Connect(function(playBackState)
if playBackState == Enum.PlaybackState.Completed then
head.Sound:Play()
head.Roar.Transparency = 0
task.wait(3.03)
head.Roar.Transparency = 1
tween4:Play()
task.wait(1)
--[[ Heres the issue]]
-- Declare the completed event first
tween2.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed then
print("Tween 2 is completed")
local clone = Shockwave:Clone()
print("Cloned shockwave")
clone.Parent = workspace
local tween = TweenService:Create(clone, ShockWaveinfo, goals)
tween:Play()
print("Playing tween on shockwave")
tween.Completed:Connect(function(playBackState)
if playBackState == Enum.PlaybackState.Completed then
clone:Destroy()
end
end)
end
end)
-- Play the tween now
tween2:Play()
--[[ Heres the issue]]
task.wait(1.5)
Leg.Sound:Play()
end
end)
task.wait(10)
script.Parent.Color = Color3.new(1, 1, 0)
Debounce = false
elseif MarketplaceService:UserOwnsGamePassAsync(player.UserId, 122099059) and Debounce == true then
CoolDown.Enabled = true
local random = math.random(1, 5)
if random == 1 then
CoolDown.TextLabel.Text = "CoolDown"
elseif random == 2 then
CoolDown.TextLabel.Text = "Be Patient!"
elseif random == 3 then
CoolDown.TextLabel.Text = "Chill"
elseif random == 4 then
CoolDown.TextLabel.Text = "pls no"
elseif random == 5 then
CoolDown.TextLabel.Text = "STOP CLICKING ME!!!"
end
task.wait(1)
CoolDown.Enabled = false
end
else
game:GetService("ReplicatedStorage").Events.VIPPopUp:FireClient(player)
end
end)
EDIT:
The tween2 info, says it should play during 0.6 secs, so it finished before you connected the completed event which occurs after the task.wait(1.5).
Thats why the error, cause it ended before you declare what to do when completed