local TweenService = game:GetService(“TweenService”)
local UserInputService = game:GetService(“UserInputService”)
local RunService = game:GetService(“RunService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Players = game:GetService(“Players”)

local ClientSettings = ReplicatedStorage.ClientSettings.Controls
local Particles = ReplicatedStorage.Resources
local Beam = Particles.Particles.Beam:Clone()
local Outlines = Particles.Outlines

local Player = Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local UI = PlayerGui.UI
local Values = Player.Character:WaitForChild(“Values”)

local Fetch = nil
local HoldingKey = false
local HoldTime = 5
local HoldTimer = 0
local Closest_part = nil
local Holding = nil
local Executing = false

local TimerValue = UI.Gameplay.ReviveFrame.Progress
local SeekValue = UI.Gameplay.SeekFrame.Progress

repeat task.wait(.5) until Player.Character:FindFirstChild(“Humanoid”) and Player.Character:FindFirstChild(“Torso”)

local function FetchWeapon(PlayerModel)
if PlayerModel:FindFirstChild(“Fists”) then
return “Fists”
elseif PlayerModel:FindFirstChild(“Pipe”) then
return “Pipe”
elseif PlayerModel:FindFirstChild(“Zweihander”) then
return “Zweihander”
end
end

local function IsHuman(PlayerModel)
return PlayerModel.Parent == workspace.GameSettings.Humans
end

local function IsSeeker(PlayerModel)
return PlayerModel.Parent == workspace.GameSettings.Seekers
end

local function InitiateRevive(PlayerModel, State, Fetch)
ReplicatedStorage.Remotes.Interact:FireServer(PlayerModel, State, Fetch)
end

local function CanRevive()
return Values.CurrentAbility.Value == “Healer”
end

local function CanFinish()
local Weapon = FetchWeapon(Player.Character)
return Weapon and not UI.Gameplay.Interact.Damage.Visible
end

local function CanSeek()
return UI.Gameplay.Interact.Seek.Visible
end

local function FaceEachOther(P1, P2)
local Direction = (P2.Position - P1.Position).unit
local Angle = math.atan2(Direction.X, Direction.Z)
local Rotation = CFrame.new(P1.Position) * CFrame.Angles(0, math.rad(180 + math.deg(Angle)), 0)
TweenService:Create(P1, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = Rotation}):Play()
end

local function OnKeyPress(input, gameProcessed)
if Closest_part and Closest_part:FindFirstChild(“Values”) then
if Closest_part.Settings.Downed.Value and Closest_part.Humanoid.Health > 1 then
if input.KeyCode == Enum.KeyCode[ClientSettings.Revive.Value] and not HoldingKey then
if CanRevive() and IsHuman(Player.Character) then
HoldingKey = true
HoldTimer = tick() + HoldTime
Holding = “Revive”
InitiateRevive(Closest_part, “Outline”)
FaceEachOther(Player.Character.HumanoidRootPart, Closest_part.HumanoidRootPart)
end
elseif input.KeyCode == Enum.KeyCode[ClientSettings.Finish.Value] then
if CanFinish() and IsHuman(Player.Character) and not Executing then
Executing = true
FaceEachOther(Player.Character.HumanoidRootPart, Closest_part.HumanoidRootPart)
InitiateRevive(Closest_part, “Finish”, FetchWeapon(Player.Character))
task.wait(7)
Executing = false
end
elseif input.KeyCode == Enum.KeyCode.C then
if CanSeek() and IsSeeker(Player.Character) then
HoldingKey = true
HoldTimer = tick() + HoldTime
Holding = “Seek”
InitiateRevive(Closest_part, “SeekOutline”)
Player.Character.Humanoid:UnequipTools()
end
end
end
end
end

local function OnKeyRelease(input, gameProcessed)
if input.KeyCode == Enum.KeyCode[ClientSettings.Revive.Value] then
HoldingKey = false
InitiateRevive(Closest_part, “OutlineRemove”)
elseif input.KeyCode == Enum.KeyCode.C then
HoldingKey = false
InitiateRevive(Closest_part, “OutlineRemove”)
end
end

UserInputService.InputBegan:Connect(OnKeyPress)
UserInputService.InputEnded:Connect(OnKeyRelease)

RunService.Heartbeat:Connect(function()
if HoldingKey then
local Elapsed = math.max(0, HoldTime - (HoldTimer - tick()))
local Progress = (Elapsed / HoldTime) * 5
Progress = math.min(Progress, 5)
if Holding == “Revive” then
TimerValue.Value = Progress
else
SeekValue.Value = Progress
end

if Progress >= 5 then
if Holding == “Revive” then
PlayerGui.UI.Visual.Vignette.ImageColor3 = Color3.fromRGB(0, 255, 127)
PlayerGui.UI.Visual.WhiteFlash.BackgroundColor3 = Color3.fromRGB(0, 255, 127)
InitiateRevive(Closest_part, “Revive”)
else
PlayerGui.UI.Visual.Vignette.ImageColor3 = Color3.fromRGB(85, 0, 255)
InitiateRevive(Closest_part, “Seek”)
UI.Gameplay.Interact.Revive.Visible = false
UI.Gameplay.Interact.Damage.Visible = false
UI.Gameplay.Interact.Seek.Visible = false
end
HoldingKey = false
TimerValue.Value = 0
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true), {FieldOfView = 80}):Play()
TweenService:Create(PlayerGui.UI.Visual.Vignette, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {ImageTransparency = 0}):Play()
task.wait(1.5)
TweenService:Create(PlayerGui.UI.Visual.Vignette, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {ImageTransparency = 1}):Play()
TweenService:Create(PlayerGui.UI.Visual.WhiteFlash, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {BackgroundTransparency = 1}):Play()
end
else
TimerValue.Value = 0
SeekValue.Value = 0
end

local Player_position = Player.Character.Torso.Position

for _, PlayerModel in workspace.GameSettings.Humans:GetChildren() do
if PlayerModel:IsA(“Model”) and PlayerModel:FindFirstChild(“Humanoid”) and PlayerModel:FindFirstChild(“Torso”) then
local Character = PlayerModel
local Downed = Character.Values:FindFirstChild(“Downed”)
local Stunned = Character.Values:FindFirstChild(“Stunned”)
local Torso_position = Character.Torso.Position

if (Torso_position - Player_position).Magnitude < 8 then
if Downed and Downed.Value and not Character.Values.Locked.Value then
UI.Gameplay.Interact.Visible = Downed.Value
Closest_part = Character
if Values.CurrentAbility.Value == “Healer” then
UI.Gameplay.Interact.Revive.Visible = true
else
UI.Gameplay.Interact.Revive.Visible = false
end

if Closest_part.Humanoid.Health <= 15 then
UI.Gameplay.Interact.Damage.Visible = false
UI.Gameplay.Interact.Seek.Visible = true
else
UI.Gameplay.Interact.Damage.Visible = true
UI.Gameplay.Interact.Seek.Visible = false
end
end
else
if Closest_part == Character then
Closest_part = nil
end
end
end
end

if Closest_part then
UI.Gameplay.Interact.Visible = true
if Values.CurrentAbility.Value == “Healer” then
UI.Gameplay.Interact.Revive.Visible = Closest_part.Humanoid.Health > 1 and CanRevive() and IsHuman(Player.Character)
else
UI.Gameplay.Interact.Revive.Visible = false
end

UI.Gameplay.Interact.Damage.Visible = Closest_part.Humanoid.Health <= 15 and not CanFinish() and IsHuman(Player.Character)
UI.Gameplay.Interact.Seek.Visible = CanSeek() and IsSeeker(Player.Character)
else
UI.Gameplay.Interact.Visible = false
end
end)

rewrite this script to use ContextActionService instead of UserInputService.