I want to make it so every rebirth you gain 0.25 dmg but an error occurred.
15:10:43.471 - Workspace.tecknobladee.Punch.Handle.Damage:6: attempt to index nil with 'leaderstats'
script.Parent.Touched:Connect(function(hit, player) local humanoid = hit.Parent:FindFirstChildWhichIsA('Humanoid') if humanoid then humanoid:TakeDamage(player.leaderstats.rebirths.Value / 4 + 5) end end)
The Touched event only returns one parameter, and that the thing that hit the part. It doesn't return the player that touched the part. Since you're already checking if the thing that hit the part is a character, you can get the player from the character if it has one by using the Players:GetPlayerFromCharacter function.
EDIT: You can get the player's Character that is holding the tool by just using script.Parent's. Then you can use the Players:GetPlayerFromCharacter function to get the player from the Character.
local Players = game:GetService("Players") script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildWhichIsA('Humanoid') if humanoid then local CurrentCharacter = script.Parent.Parent.Parent -- You may need to change how many parent's you need to reach the Character local CurrentPlayer = Players:GetPlayerFromCharacter(CurrentCharacter) humanoid:TakeDamage(CurrentPlayer.leaderstats.rebirths.Value / 4 + 5) end end)
Hope this helps.
local Players = game:GetService("Players") script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildWhichIsA('Humanoid') if humanoid then local player = Players:GetPlayerFromCharacter(hit.Parent) local rebirths = player.leaderstats.rebirths humanoid:TakeDamage(rebirths.Value / 4 + 5) end end)