View difference between Paste ID: TRMMDCzS and QqV7XAnA
SHOW: | | - or go back to the newest paste.
1
local Players = game:GetService("Players")
2
local localPlayer = Players.LocalPlayer
3
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
4
local humanoid = character:WaitForChild("Humanoid")
5
local rootPart = character:WaitForChild("HumanoidRootPart")
6
7
local targetUsername = "AdoptMe9943"
8
9
local function findTargetRootPart()
10
    for _, player in ipairs(Players:GetPlayers()) do
11
        if player.Name == targetUsername then
12
            local otherCharacter = player.Character
13
            if otherCharacter then
14
                local otherRootPart = otherCharacter:FindFirstChild("HumanoidRootPart")
15
                local otherHumanoid = otherCharacter:FindFirstChild("Humanoid")
16
                
17
                if otherRootPart and otherHumanoid and otherHumanoid.Health > 0 then
18
                    return otherRootPart
19
                end
20
            end
21
        end
22
    end
23
    
24
    return nil
25
end
26
27-
-- Function to make the character jump
27+
28-
local function jump()
28+
29-
    humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
29+
30
        humanoid:MoveTo(target.Position)
31
    end
32-
-- Coroutine for random jumping
32+
33-
local function randomJumpCoroutine()
33+