Basically when the ability is activated if a player dies during it the wall stays and doesn’t destroy, I need to be able to detect if the player dies during the abilities duration, How could I do that?
local SS = game:GetService("ServerScriptService")
local RS = game:GetService("ReplicatedStorage")
local HammersModule = require(RS.HammersModule)
local TweenService = game:GetService("TweenService")
local Tool = script.Parent.Parent.Parent
local Utility = Tool:FindFirstChild("Utility")
Utility.Ability.OnServerEvent:Connect(function(Player)
local Char = Player.Character
local humanoid = Char:FindFirstChild("Humanoid")
local HRP = Char:WaitForChild("HumanoidRootPart")
local Wall = RS.Abilities.BrickHammer.BrickWall:Clone()
Wall.CFrame = HRP.CFrame * CFrame.new(0, -10, -10)
Wall.Parent = workspace
local Sound = Instance.new("Sound")
Sound.SoundId = HammersModule["Normal Hammers"][Tool.Name]["Ability SoundID"]
Sound.Volume = HammersModule["Normal Hammers"][Tool.Name]["Ability Volume"]
Sound.TimePosition = 0.87
Sound.RollOffMaxDistance = 50
Sound.RollOffMinDistance = 4
Sound.Parent = Wall
local goal1 = {}
goal1.CFrame = HRP.CFrame * CFrame.new(0, 0, -10)
local tweenInfo1 = TweenInfo.new(1.3,Enum.EasingStyle.Bounce)
local tween1 = TweenService:Create(Wall, tweenInfo1, goal1)
local goal2 = {}
goal2.CFrame = HRP.CFrame * CFrame.new(0, -10, -10)
local tweenInfo2 = TweenInfo.new(1.3,Enum.EasingStyle.Quint)
local tween2 = TweenService:Create(Wall, tweenInfo2, goal2)
Wall.ParticleEmitter.Enabled = true
tween1:Play()
Sound:Play()
wait(0.3)
Wall.ParticleEmitter.Enabled = false
wait(5)
Wall.ParticleEmitter.Enabled = true
tween2:Play()
Sound:Play()
wait(0.3)
Wall.ParticleEmitter.Enabled = false
wait(1)
Wall:Destroy()
Sound:Destroy()
end)