local function FindClosestDowned(Radius) local Characters = workspace:WaitForChild("Characters")
local closestTarget = nil local closestDistance = math.huge
for _, character in pairs(Characters:GetChildren()) do local humanoid = character:FindFirstChild("Humanoid")
if character ~= Character and character.Values.IsDowned.Value and not character.Values.BeingRevived.Value then local distance = (character.HumanoidRootPart.Position - Character.HumanoidRootPart.Position).Magnitude
if distance <= Radius and distance < closestDistance then closestTarget = character closestDistance = distance end end end
return closestTarget, closestDistance end
UIS.InputBegan:Connect(function(Input, Processed) if not Processed and not IsDowned.Value then if Input.KeyCode == Enum.KeyCode.R then local Target, Distance = FindClosestDowned(5)
Storage.Events.ReviveRemote:FireServer(Target, "Start") end end end end)
UIS.InputEnded:Connect(function(Input, Processed) if not Processed and not IsDowned.Value then if Input.KeyCode == Enum.KeyCode.R then local Target, Distance = FindClosestDowned(5)
if Target then Reviving = false Storage.Events.ReviveRemote:FireServer(Target, "Stop") end end end end)
Если нужно, могу что то уточнить.
Заранее спасибо.
(Код если что не полный)
Дополнен 3 месяца назад
P.S - конкретно нужно исправить серверный скрипт. Если нужно, можете в local script тоже что нибудь переделать
Но я не супер пупер програмиист чтобы понять как это сделать, я перепробовал всё.
Если кто то сможет помочь буду очень благодарен.
Server script:
Local script:
Если нужно, могу что то уточнить.
Заранее спасибо.
(Код если что не полный)