Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Debounce not working on projectiles, to an extent?

Asked by 5 years ago
Edited 5 years ago

So, I'm making a projectile-based PVP game, and I recently found out i was a bit 'special' creating moving parts on the server, so I'm having moving parts replicate to all clients. Everything works, apart from the debounce, which allows each thing to be hit two times exactly before stopping itself, and I can't figure out why.

Here's the code:

01---- DAMAGE FUNCTION ----
02local dmgevent = game.ReplicatedStorage:WaitForChild("DamageEvent")
03function Damage(Caster, set, Victim, dmg, Part, SpellName)--(function(Player, set, Victim, Damage, Part, SpellName)
04    if Caster.Name ~= Victim.Name then
05        dmgevent:FireServer(set, Victim, dmg, Part, SpellName)
06    end
07end
08-- THE EVENT --
09dmgevent.Name = "DamageEvent"
10dmgevent.OnServerEvent:Connect(function(Player, set, Victim, Damage, Part, SpellName)
11    MarkInfo(set, SpellName, Damage, script.BlankSpace, Part)
12    bb(Victim.Head.CFrame, "-" .. Damage, Victim, function(item, dura) game.Debris:AddItem(item, dura) end)
13    Mark(Player, function(item, dur) game.Debris:AddItem(item, dur) end, Victim.Humanoid)
14    Victim.Humanoid:TakeDamage(Damage)
15    print("Damaged" .. Victim.Name)
View all 35 lines...

b is the Projectile, and the only time Humanoid:TakeDamage is called in all of those functions is in the event (Victim.Humanoid:TakeDamage()). Everything does damage exactly two times, and I can't figure out how, so help would be appreciated! Thanks in advance.

1 answer

Log in to vote
0
Answered by 5 years ago

Was being called by all clients. Sorry!

Ad

Answer this question