I made an ability, it one shots people if I dont use a debounce but if I do it only affects 1 person. I tried make a debounce table but I dont really know how to use tables or dictionaries. the first one I made when the player touched the ability it would add them to the table, second one uses playeradded. basically I dont know how to use tables and dictionaries or how to iterate through them.
local remote = game.ReplicatedStorage.GroundSmash
local DB = false
local spawned = false
local dmglimit = false
remote.OnServerEvent:Connect(function(plr)
local PlrDB ={}
local char = plr.Character
local Hum = char:WaitForChild("Humanoid")
local HumRoot = char:WaitForChild("HumanoidRootPart")
local partloc = game.ServerStorage.Classes.UnArmed.GroundSmash
local Ground = partloc:Clone()
Ground.Parent = workspace
Hum.Touched:Connect(function(Floor)
if spawned == false then
for i, v in pairs(Ground:GetTouchingParts()) do
if v:IsA("BasePart") then
if Ground.Parent ~= workspace then return end
spawned = true
Ground.GroundSmash.BrickColor = v.BrickColor
Ground.GroundSmash.Material = v.Material
Ground.Sound:Play()
Ground.CFrame = HumRoot.CFrame + Vector3.new(0,-3,0)
game.Debris:AddItem(Ground, 1.9)
wait(5)
spawned = false
end
end
end
end)
Ground.Touched:Connect(function(closeobj)
if DB == false then
for i, d in pairs(Ground:GetTouchingParts()) do
if not d.Parent:FindFirstChild("Humanoid") then
if d:IsA("BasePart") then
if Ground.GroundSmash.BrickColor ~= d.BrickColor and Ground.GroundSmash.Material ~= d.Material then
DB = true
Ground.GroundSmash.BrickColor = d.BrickColor
Ground.GroundSmash.Material = d.Material
wait(3)
DB = false
end
end
end
end
end
end)
local TS = game:GetService("TweenService")
local info = TweenInfo.new(
0.6,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
true,
0
)
local goals = {
Size = Vector3.new(55.501, 13.087, 55.142);
Transparency = 0
}
local goal = {
Size = Vector3.new(3, 3, 3)
}
local twen = TS:Create(Ground.GroundSmash, info, goals)
local tween = TS:Create(Ground, info, goal)
tween:Play()
twen:Play()
Ground.GroundSmash.Touched:Connect(function(hit)
local GetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
--------------------------Debounce here
hit.Humanoid:TakeDamage(25)
end
end)
end)

2 comments
Wow it was this simple? Ty very much.
/shrug