0% found this document useful (0 votes)
32 views5 pages

Iwjdnned

The document outlines a local script for a Roblox game that creates an R6 character model named 'ObbyStalker' which mimics player movements and follows them using pathfinding. It includes functionalities such as matching player speed and jump, playing animations based on actions, and sending notifications when the entity 'touches' the player. Additionally, it handles character respawn to ensure continuous tracking of the player.

Uploaded by

nessinlovely94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views5 pages

Iwjdnned

The document outlines a local script for a Roblox game that creates an R6 character model named 'ObbyStalker' which mimics player movements and follows them using pathfinding. It includes functionalities such as matching player speed and jump, playing animations based on actions, and sending notifications when the entity 'touches' the player. Additionally, it handles character respawn to ensure continuous tracking of the player.

Uploaded by

nessinlovely94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

-- Roblox obby manhunt local script Script: Obby-Savvy R6 Entity with Movement

Mimicking
local Players = game:GetService("Players")
local PathfindingService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local StarterGui = game:GetService("StarterGui")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

-- Create R6 character model


local function createR6Entity()
local entity = Instance.new("Model")
entity.Name = "ObbyStalker"

-- Create R6 rig
local humanoid = Instance.new("Humanoid")
humanoid.Parent = entity
humanoid.WalkSpeed = 16 -- Match player speed
humanoid.JumpPower = 50 -- Match player jump
humanoid.HipHeight = 2 -- Standard R6 height
humanoid.AutoRotate = true -- Face movement direction

local rootPart = Instance.new("Part")


rootPart.Size = Vector3.new(2, 2, 1)
rootPart.Name = "HumanoidRootPart"
rootPart.Anchored = false
rootPart.CanCollide = true
rootPart.Parent = entity

-- Add R6 body parts


local torso = Instance.new("Part")
torso.Size = Vector3.new(2, 2, 1)
torso.Name = "Torso"
torso.Parent = entity

local head = Instance.new("Part")


head.Size = Vector3.new(1, 1, 1)
head.Name = "Head"
head.Parent = entity

local leftArm = Instance.new("Part")


leftArm.Size = Vector3.new(1, 2, 1)
leftArm.Name = "Left Arm"
leftArm.Parent = entity

local rightArm = Instance.new("Part")


rightArm.Size = Vector3.new(1, 2, 1)
rightArm.Name = "Right Arm"
rightArm.Parent = entity

local leftLeg = Instance.new("Part")


leftLeg.Size = Vector3.new(1, 2, 1)
leftLeg.Name = "Left Leg"
leftLeg.Parent = entity

local rightLeg = Instance.new("Part")


rightLeg.Size = Vector3.new(1, 2, 1)
rightLeg.Name = "Right Leg"
rightLeg.Parent = entity

-- Weld parts
local function weld(part1, part2, c0)
local weld = Instance.new("Weld")
weld.Part0 = part1
weld.Part1 = part2
weld.C0 = c0
weld.Parent = part1
end

weld(rootPart, torso, CFrame.new(0, 0, 0))


weld(torso, head, CFrame.new(0, 1.5, 0))
weld(torso, leftArm, CFrame.new(-1.5, 0, 0))
weld(torso, rightArm, CFrame.new(1.5, 0, 0))
weld(torso, leftLeg, CFrame.new(-0.5, -2, 0))
weld(torso, rightLeg, CFrame.new(0.5, -2, 0))

-- Add default R6 animations


local animateScript = Instance.new("Script")
animateScript.Name = "Animate"
animateScript.Source = [[
local humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator") or
Instance.new("Animator", humanoid)

-- Default R6 animation IDs


local animations = {
walk = "rbxassetid://180426354",
run = "rbxassetid://180426354",
jump = "rbxassetid://125750702",
idle = "rbxassetid://180435571",
climb = "rbxassetid://180436148"
}

local currentTrack = nil

local function playAnimation(animId)


if currentTrack then
currentTrack:Stop()
end
local animTrack = Instance.new("Animation")
animTrack.AnimationId = animId
local track = animator:LoadAnimation(animTrack)
track:Play()
currentTrack = track
end

-- Sync animations with movement


humanoid.Running:Connect(function(speed)
if speed > 0 then
playAnimation(animations.run)
else
playAnimation(animations.idle)
end
end)

humanoid.Jumping:Connect(function()
playAnimation(animations.jump)
end)

humanoid.Climbing:Connect(function()
playAnimation(animations.climb)
end)
]]
animateScript.Parent = entity

-- Add player's avatar appearance


local characterAppearance =
Players:GetCharacterAppearanceAsync(LocalPlayer.UserId)
characterAppearance.Parent = entity

entity.Parent = game.Workspace
return entity, humanoid, rootPart
end

local entity, entityHumanoid, entityRootPart = createR6Entity()


local followDistance = 3 -- Try to stay ~3 studs behind
local touchDistance = 1 -- "Touch" if within 1 stud
local lastTouchTime = 0 -- Cooldown for taunt
local touchCooldown = 5 -- 5 seconds between taunts

-- Pathfinding to follow player


local function followPlayer()
if not Character or not HumanoidRootPart or not entityRootPart then return end

local playerPos = HumanoidRootPart.Position


local offset = HumanoidRootPart.CFrame.LookVector * -followDistance
local targetPos = playerPos + offset

-- Create path
local path = PathfindingService:CreatePath({
AgentRadius = 2,
AgentHeight = 5,
AgentCanJump = true,
Costs = {
Water = 20,
Unwalkable = math.huge
}
})

-- Compute path to target


local success, errorMessage = pcall(function()
path:ComputeAsync(entityRootPart.Position, targetPos)
end)

if success and path.Status == Enum.PathStatus.Success then


local waypoints = path:GetWaypoints()

-- Move to next waypoint


for i, waypoint in ipairs(waypoints) do
if not entityHumanoid or entityHumanoid.Health <= 0 then break end
entityHumanoid:MoveTo(waypoint.Position)

-- Handle jumps
if waypoint.Action == Enum.PathWaypointAction.Jump then
entityHumanoid.Jump = true
end
-- Wait until reaching waypoint or timeout
local reached = false
local timeout = tick() + 2 -- 2-second timeout
while tick() < timeout and not reached do
if (entityRootPart.Position - waypoint.Position).Magnitude < 1 then
reached = true
end
RunService.Heartbeat:Wait()
end
end
else
-- Fallback: Move directly if pathfinding fails
entityHumanoid:MoveTo(targetPos)
end
end

-- Mimic player movements and check for touch


RunService.Heartbeat:Connect(function()
if Character and HumanoidRootPart and entityRootPart then
-- Mimic player's actions
local playerHumanoid = Character:FindFirstChildOfClass("Humanoid")
if playerHumanoid then
-- Match movement direction
entityHumanoid:Move(playerHumanoid.MoveDirection)

-- Match jump
if playerHumanoid.Jump then
entityHumanoid.Jump = true
end

-- Match climbing
if playerHumanoid:GetState() == Enum.HumanoidStateType.Climbing then
entityHumanoid:ChangeState(Enum.HumanoidStateType.Climbing)
end
end

-- Check for "touch"


local playerPos = HumanoidRootPart.Position
local distance = (playerPos - entityRootPart.Position).Magnitude
if distance <= touchDistance and (tick() - lastTouchTime) >= touchCooldown
then
StarterGui:SetCore("SendNotification", {
Title = "Caught!",
Text = "You got touched by the entity, you noob!",
Duration = 3
})
lastTouchTime = tick()
end
end
end)

-- Run pathfinding in a loop


spawn(function()
while true do
if entity and entityHumanoid and entityHumanoid.Health > 0 then
followPlayer()
end
wait(0.5) -- Recalculate path every 0.5 seconds
end
end)

-- Handle character respawn


LocalPlayer.CharacterAdded:Connect(function(newChar)
Character = newChar
HumanoidRootPart = newChar:WaitForChild("HumanoidRootPart")
end)

You might also like