1. Создайте новый скрипт в StarterCharacterScripts.
2. Вставьте следующий код в скрипт:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local toolName = "YourToolNameHere" -- Название инструмента, который вы хотите выдать
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local player = Players:GetPlayerFromCharacter(character)
local function onHealthChanged(health)
if health <= humanoid.MaxHealth * 0.5 then
-- Проверяем, есть ли у игрока уже инструмент
if not player.Backpack:FindFirstChild(toolName) and not character:FindFirstChild(toolName) then
local tool = ReplicatedStorage:FindFirstChild(toolName):Clone()
tool.Parent = player.Backpack
end
end
end
humanoid.HealthChanged:Connect(onHealthChanged)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)