So my script has an error but nothing is wrong I’m so confused, can anyone identify anything wrong with this. The part of the script with the error is down the bottom with the stars, it has a red line underneath the last end.


local AvadaKedavraRemote = RemotesFolder.AvadaKedavra
AvadaKedavraRemote.OnServerEvent:Connect(function(Player, MousePos)
--setup
local Spell = RepStorage["Particles/Effects"].AvadaKedavra:Clone()
local Animation = script.Parent.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(RandomAnimation)
if Animation.IsPlaying then
else
Animation:Play()
end
Spell.Parent = Player.Character.SpellDebris
Spell.Name = "Avada Kedavra"
Spell.CFrame = SpellCastPart.CFrame
--Tween stuff
local Distance = (Spell.Position - MousePos).magnitude
local Speed = 200
local function GetTime(Distance, Speed)
local Time = Distance / Speed
return Time
end
local Time = GetTime(Distance, Speed)
print(Time)
local TweenInfo1 = TweenInfo.new(
Time,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local TweenGoals = {
Position = MousePos;
}
local Tween = TweenService:Create(Spell, TweenInfo1, TweenGoals)
Tween:Play()
**Tween.Completed:Connect(function(PlayBackState)**
** if playbackState == Enum.PlaybackState.Completed then**
** Spell:Destroy()**
** end**
** end**
**end)**