How would i make a sword like this

how would i make a sword that deals 3 dmg, but theres a debounce and it ends when anim ends, but the debounce is not global its for everyone seperately

5 Likes

do you have an example for the sword you want to make ?

2 Likes

uh not exactly but if u dont get it what i mean is, yk the classic roblox sword, if u just hold it and walk into someone, they take dmg, i dont want that to happen

3 Likes

so the issue is you do not the sword to damage players when they touch the sword ?

2 Likes

did you try making it ?
weird interesting text because of a weirder limit

1 Like

ye i want it to only damage while its swinging, and also while its swinging it deals the dmg value multiple times

2 Likes

i tried but it doesnt work so i deleted it so now im just using a normal sword for toolbox just for testing ( u dont need to like all my posts )

do you have the script for the sword that did not work ?

nope i deleted the entire sword

you can use a hitbox or the .Touched event to detect when the sword hit somebody , if you would use the .Touched event then just connect to the event just before playing the swing animation and after the animation ends disconnect from the event

how does your hitbox work or do want the sword itself to be he hitbox.

ill try help once u specify

i want the sword to be the hitbox, but it would only deal dmg when the anim plays, but even when it is touched when anim plays, it deals dmg multiple times

1 Like

oh i see lemme try cough up a script quickly

disconnect from the .Touched event when it deals the damage

but would that disconnect it globally

then put the hitted players in a table and check if the player in the table or not before dealing the damage

1 Like

try this is a serverscript in the handle. (srry if this is buggy, also replace anim)

local debounce = false
local swordDebounce = false
script.Parent.Activated:Connect(function()
	if not debounce then
		debounce = true
		game.Players[script.Parent.Parent.Parent.Parent.Name].Character:WaitForChild("Humanoid"):LoadAnimation(anim)
		script.Parent.Touched:Connect(function(hit)
			if not swordDebounce and hit.Parent:FindFirstChild("Humanoid") then
				swordDebounce = true
				hit.Parent.Humanoid:TakeDamage(3)
			end
		end)
		wait(1)
		swordDebounce = false
		debounce = false
	end
end)
1 Like

this will disable the damage globally he wants it for every player

2 Likes

oh, lemme make some edits. gimme a sec

2 Likes

just store the hitted players in a table and check if the player in the table or not before dealing damage