local TweenService = game:GetService("TweenService") local ContextActionService =…
- User
local TweenService = game:GetService("TweenService") local ContextActionService = game:GetService("ContextActionService") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local StarterGui = game:GetService("StarterGui")
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 Carrying = false local Seeking = false local Hidden = false
local TimerValue = UI.Gameplay.ReviveFrame.Progress local SeekValue = UI.Gameplay.SeekFrame.Progress
local Settings = Player.Character:WaitForChild("Settings")
local Checks = true
repeat task.wait(.5) until Player.Character:FindFirstChild("Humanoid") and Player.Character:FindFirstChild("Torso") local Humanoid = Player.Character:FindFirstChild("Humanoid")
local AnimationInstance = Instance.new("Animation") AnimationInstance.AnimationId = "rbxassetid://17668406629" AnimationInstance.Parent = workspace.Debris local CarryIdleAnimation = Humanoid:LoadAnimation(AnimationInstance) AnimationInstance:Destroy()
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) if Carrying then return false end return not Checks or PlayerModel.Parent == workspace.GameSettings.Humans end
local function IsSeeker(PlayerModel) if Carrying then return false end return not Checks or PlayerModel.Parent == workspace.GameSettings.Seekers end
local function InitiateRevive(PlayerModel, State, Fetch) ReplicatedStorage.Remotes.Interact:FireServer(PlayerModel, State, Fetch) end
local function CanRevive() return not Checks and Values.CurrentAbility.Value == "Healer" end
local function CanFinish() if Carrying then return false end local Weapon = FetchWeapon(Player.Character) --return Weapon and UI.Gameplay.Interact.Damage.Visible and IsSeeker(Player.Character) end
local function CanSeek() return not Checks or UI.Gameplay.Interact.Seek.Visible end
local function CanCarry() return not Checks or 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
- Assistant
To add the seek mechanic to the
UserInputService.InputBeganevent, you can add a conditional check within theUserInputService.InputBeganfunction to handle the input for seeking. Here's the updated piece of code that includes the seek mechanic:UserInputService.InputBegan:Connect(function(key, nottyping) if key.KeyCode == Enum.KeyCode.G then if nottyping then if CanSeek() and IsSeeker(Player.Character) then if Settings.Carrying.Value or Settings.Crouching.Value or Settings.Downed.Value or Settings.Carried.Value then return end Seeking = true Hidden = true HoldingKey = true HoldTimer = tick() + HoldTime Holding = "Seek" InitiateRevive(Closest_part, "SeekOutline") Player.Character.Humanoid:UnequipTools() UpdateInteractFrames("Seek") end end end end)This code will check if the "G" key is pressed and if the player is not typing. If the conditions for seeking are met (CanSeek and IsSeeker return true, and the player's settings are appropriate), it initiates the seek mechanic by setting the appropriate flags, initiating the revive process with the "SeekOutline" state, and updating the interaction frames.