Guys, I want to get Humanoid with function(hit) but i want to use it outside of the function(hit). How do I do that?
Here is My Script
local Knife = script.Parent local db = true if db == true then Knife.Touched:Connect(function(hit) local Humanoid = hit.Parent:WaitForChild("Humanoid") end) Humanoid:TakeDamage(1) end
Try this.
local Knife = script.Parent local db = true local Humanoid if db == true then Knife.Touched:Connect(function(hit) Humanoid = hit.Parent:WaitForChild("Humanoid") end) Humanoid:TakeDamage(1) end