Tools only damage when active

How do you do it, because mine doesn’t work?

local part = script.Parent --
local Debounce = false --(Cooldown)
local tool = script.Parent.Parent
if not tool.Activated then
	return
end

part.Touched:Connect(function(OtherPart)
	if not OtherPart:IsDescendantOf(workspace.misc_) then
		return 
	end
	if Debounce == false then
		Debounce = true         --Cooldown
		local Char = game.Players.LocalPlayer.Character
		local Humanoid = Char.Humanoid
		Humanoid:TakeDamage(50) 
		task.wait()
		Debounce = false
	end		--Debounce
end)

Could tool.equipped work? char

equipped work, but im looking for the damage thing rnow

Tool.Activated:Connect(function()
if Debounce == false then
		Debounce = true         --Cooldown
		local Char = game.Players.LocalPlayer.Character
		local Humanoid = Char.Humanoid
		Humanoid:TakeDamage(50) 
		task.wait()
		Debounce = false
	end		--Debounce
end)

Local scripts dont work in the workspace, which is why nothing is happening. Try moving the part (script.Parent) into workspace and moving the local script into the tool and the tool into StarterPack

PS: You cannot check Tool.Activated like that since it’s an event, not a Boolean.
Try this revised script

-- Local script in tool in starter pack (Make sure there's a part "Handle" in the tool)
local part = workspace. Part --
local Debounce = false --(Cooldown)
local tool = script.Parent
local active
tool.Activated:Connect(function()
   active = true
end)
tool.Deactivated:Connect(function()
   active = false
end)
part.Touched:Connect(function(OtherPart)
	if not OtherPart:IsDescendantOf(workspace.misc_) then
		return 
	end
	if Debounce == false and active then
		Debounce = true         --Cooldown
		local Char = game.Players.LocalPlayer.Character
		local Humanoid = Char.Humanoid
		Humanoid:TakeDamage(50) 
		task.wait()
		Debounce = false
	end		--Debounce
end)

im using server script,
sigma sigma sigma bypass

Buddy you cant access local player in server script. Follow my steps and it should work

1 Like

Also bool debounce is ok but better to use time-based cooldown

1 Like

If part is a child of tool, then it is only in workspace whenever the tool is equipped. The parent of tool is ‘backpack’, when it isn’t selected, which means the part can never be touched. When you equip a tool, it parents it to your character, so a descendant of workspace.

Also, ‘tool activated’ means something else: it’s an event which fires every time a player clicks, with an equipped tool. You’re looking for ‘tool.Equipped’