So I’ve been working a combat system and i wanted it to deal x amount of damage to another player but when I test it, It deals more then the x amount of damage. How would i go about fixing this.
I’ve Also tried reading other scripts and I’ve come across something common in some of the script. In some of the scripts people would tag another player. Could someone explain what tagging the player does
Very quick response, just add a wait before the line Cooldown = false, and put local Cooldown = falseoutside of the .Touched event:
local Cooldown = false
RightArm.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and not Cooldown then
Cooldown = true
Hit.Parent.Humanoid:TakeDamage(5)
wait(0.5) -- or shorter/longer
Cooldown = false
end
end)
To answer your question in the end, weapons use “tags” on the players they hit as a way for scripts to figure out who killed them. Without this, there wouldn’t be a good way to create a kill scoring system.