i need help with this script
script: local char = script.Parent local hum = char.Humanoid
hum.HealthChanged:Connect(function() if hum.Health <= 15 then local Players = game:GetService("Players"
local player = Players:FindFirstChildOfClass("Humanoid" if humanoid then local tool = workspace:FindFirstChild("Tool if tool then Humanoid:UnequipTools end end end
So if this were me, then I would write it like this.
local Players = game:GetService("Players") local character = script.Parent local humanoid = Character:WaitForChild("Humanoid") humanoid.HealthChanged:Connect(function(health) if (health < 15) then local plrToGet= Players:GetPlayerFromCharacter(character) if (not plrToGet) then return end plrToGet.Backpack:ClearAllChildren() local equippedTool = character:FindFirstChildOfClass("Tool") if (equippedTool) then equippedTool:Destroy() end end end)
Hoped this helped. If you need any more insight, let me know!
Humanoid:UnequipTools() is a method so you need to have those parenthesis "()" after it.