I made an ability that creates a beam and damages the player but instead of 35 dmg it kills them.
Here is the Code:
local remote = game.ReplicatedStorage.BarrierBeam remote.OnServerEvent:Connect(function(plr,mouseaim) local parts = game.ServerStorage.Classes.BarrierMaster local BeamLoc = parts.BarrierBeam local Beam = BeamLoc:Clone() Beam.Parent = workspace Beam.CFrame = CFrame.new(mouseaim) local dmg = game.Workspace.BarrierBeam.Damagepart game.Debris:AddItem(Beam, 1.7) wait(1.5) dmg.Transparency = 0.6 dmg.Touched:Connect(function(hit) for i,v in pairs(workspace:GetChildren()) do local Debounce = false if hit.Parent:FindFirstChild("Humanoid")and Debounce == false and hit.Parent.Name ~= plr.Name then Debounce = true hit.Parent.Humanoid:TakeDamage(35) wait(2) Debounce = false end end end) end)
dmg.Touched:Connect(function(hit) for i,v in pairs(workspace:GetChildren()) do local Debounce = false -- you are setting the debounce every time it touches something. This line should be next to "local remote" on line 2 above the whole function. Then you can remove this line here if hit.Parent:FindFirstChild("Humanoid")and Debounce == false and hit.Parent.Name ~= plr.Name then Debounce = true hit.Parent.Humanoid:TakeDamage(35) wait(2) Debounce = false end end end) end)
Maybe At line 18 put hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 35