I am making a game where you have health and this is the script that i used for the health pack and i dont know why it doesnt work even when i damage myself
local canPickup = true script.Parent.Model.Touched:Connect(function(hit) if hit.Parent ~= nil and game.Players:GetPlayerFromCharacter(hit.Parent) and canPickup == true then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local playerHealth = player.Character.Humanoid.Health local playerMaxHealth = player.Character.Humanoid.MaxHealth if playerHealth ~= playerMaxHealth and playerHealth > 0 then canPickup = false if playerHealth + (playerHealth / 2) > playerMaxHealth then playerHealth = playerHealth + (playerMaxHealth - playerHealth) else playerHealth = playerHealth + (playerMaxHealth / 2) end script.Parent.Model.Transparency = 1 wait(10) canPickup = true script.Parent.Model.Transparency = 0 end end end)