Run it
Copy the script and paste it into your executor.
Players = :()
UserInputService = :()
RunService = :()
PathfindingService = :()
TweenService = :()
LocalPlayer = Players.LocalPlayer
PlayerGui = LocalPlayer:()
CONFIG = {
DETECTION_RADIUS = ,
FLEE_RADIUS = ,
MOVE_SPEED = ,
SMOOTHING_FACTOR = ,
ROTATION_SMOOTHING = ,
PATHFIND_TIMEOUT = ,
JUMP_COOLDOWN = ,
}
isEnabled =
currentVelocity = .(, , )
targetVelocity = .(, , )
lastPathfindTime =
lastJumpTime =
currentWaypoints = {}
currentWaypointIndex =
bodyVelocity =
bodyGyro =
ScreenGui = .()
ScreenGui.Name =
ScreenGui.ResetOnSpawn =
ScreenGui.ZIndexBehavior = .ZIndexBehavior.Sibling
ScreenGui.Parent = PlayerGui
MainFrame = .()
MainFrame.Name =
MainFrame.Size = .(, , , )
MainFrame.Position = .(, -, , )
MainFrame.BackgroundColor3 = .(, , )
MainFrame.BorderSizePixel =
MainFrame.Active =
MainFrame.Parent = ScreenGui
MainCorner = .()
MainCorner.CornerRadius = .(, )
MainCorner.Parent = MainFrame
DropShadow = .()
DropShadow.Name =
DropShadow.Size = .(, , , )
DropShadow.Position = .(, -, , -)
DropShadow.BackgroundTransparency =
DropShadow.Image =
DropShadow.ImageColor3 = .(, , )
DropShadow.ImageTransparency =
DropShadow.ScaleType = .ScaleType.Slice
DropShadow.SliceCenter = Rect.(, , , )
DropShadow.ZIndex = -
DropShadow.Parent = MainFrame
AnimatedBG = .()
AnimatedBG.Name =
AnimatedBG.Size = .(, , , )
AnimatedBG.BackgroundColor3 = .(, , )
AnimatedBG.BorderSizePixel =
AnimatedBG.ClipsDescendants =
AnimatedBG.Parent = MainFrame
BGCorner = .()
BGCorner.CornerRadius = .(, )
BGCorner.Parent = AnimatedBG
GradientFrame = .()
GradientFrame.Name =
GradientFrame.Size = .(, , , )
GradientFrame.Position = .(-, , -, )
GradientFrame.BackgroundTransparency =
GradientFrame.BorderSizePixel =
GradientFrame.Parent = AnimatedBG
MainGradient = .()
MainGradient.Color = ColorSequence.({
ColorSequenceKeypoint.(, .(, , )),
ColorSequenceKeypoint.(, .(, , )),
ColorSequenceKeypoint.(, .(, , )),
ColorSequenceKeypoint.(, .(, , ))
})
MainGradient.Rotation =
MainGradient.Parent = GradientFrame
GlowOrb = .()
GlowOrb.Name =
GlowOrb.Size = .(, , , )
GlowOrb.Position = .(, , , )
GlowOrb.BackgroundColor3 = .(, , )
GlowOrb.BackgroundTransparency =
GlowOrb.BorderSizePixel =
GlowOrb.Parent = AnimatedBG
GlowCorner = .()
GlowCorner.CornerRadius = .(, )
GlowCorner.Parent = GlowOrb
GlowOrb2 = .()
GlowOrb2.Name =
GlowOrb2.Size = .(, , , )
GlowOrb2.Position = .(, , , )
GlowOrb2.BackgroundColor3 = .(, , )
GlowOrb2.BackgroundTransparency =
GlowOrb2.BorderSizePixel =
GlowOrb2.Parent = AnimatedBG
GlowCorner2 = .()
GlowCorner2.CornerRadius = .(, )
GlowCorner2.Parent = GlowOrb2
ContentFrame = .()
ContentFrame.Name =
ContentFrame.Size = .(, -, , -)
ContentFrame.Position = .(, , , )
ContentFrame.BackgroundColor3 = .(, , )
ContentFrame.BackgroundTransparency =
ContentFrame.BorderSizePixel =
ContentFrame.Parent = MainFrame
ContentCorner = .()
ContentCorner.CornerRadius = .(, )
ContentCorner.Parent = ContentFrame
BorderStroke = .()
BorderStroke.Color = .(, , )
BorderStroke.Thickness =
BorderStroke.Transparency =
BorderStroke.Parent = ContentFrame
TitleLabel = .()
TitleLabel.Name =
TitleLabel.Size = .(, , , )
TitleLabel.Position = .(, , , )
TitleLabel.BackgroundTransparency =
TitleLabel.Text =
TitleLabel.TextColor3 = .(, , )
TitleLabel.TextSize =
TitleLabel.Font = .Font.GothamBold
TitleLabel.TextXAlignment = .TextXAlignment.Center
TitleLabel.Parent = ContentFrame
TitleGradient = .()
TitleGradient.Color = ColorSequence.({
ColorSequenceKeypoint.(, .(, , )),
ColorSequenceKeypoint.(, .(, , )),
ColorSequenceKeypoint.(, .(, , ))
})
TitleGradient.Parent = TitleLabel
ToggleContainer = .()
ToggleContainer.Name =
ToggleContainer.Size = .(, , , )
ToggleContainer.Position = .(, -, , )
ToggleContainer.BackgroundTransparency =
ToggleContainer.Parent = ContentFrame
ToggleTrack = .()
ToggleTrack.Name =
ToggleTrack.Size = .(, , , )
ToggleTrack.Position = .(, -, , -)
ToggleTrack.BackgroundColor3 = .(, , )
ToggleTrack.BorderSizePixel =
ToggleTrack.Parent = ToggleContainer
TrackCorner = .()
TrackCorner.CornerRadius = .(, )
TrackCorner.Parent = ToggleTrack
TrackStroke = .()
TrackStroke.Color = .(, , )
TrackStroke.Thickness =
TrackStroke.Parent = ToggleTrack
ToggleKnob = .()
ToggleKnob.Name =
ToggleKnob.Size = .(, , , )
ToggleKnob.Position = .(, , , -)
ToggleKnob.BackgroundColor3 = .(, , )
ToggleKnob.BorderSizePixel =
ToggleKnob.Parent = ToggleTrack
KnobCorner = .()
KnobCorner.CornerRadius = .(, )
KnobCorner.Parent = ToggleKnob
KnobGlow = .()
KnobGlow.Name =
KnobGlow.Size = .(, , , )
KnobGlow.Position = .(, , , )
KnobGlow.BackgroundColor3 = .(, , )
KnobGlow.BackgroundTransparency =
KnobGlow.BorderSizePixel =
KnobGlow.Parent = ToggleKnob
KnobGlowCorner = .()
KnobGlowCorner.CornerRadius = .(, )
KnobGlowCorner.Parent = KnobGlow
StatusLabel = .()
StatusLabel.Name =
StatusLabel.Size = .(, , , )
StatusLabel.Position = .(, , , )
StatusLabel.BackgroundTransparency =
StatusLabel.Text =
StatusLabel.TextColor3 = .(, , )
StatusLabel.TextSize =
StatusLabel.Font = .Font.GothamMedium
StatusLabel.TextXAlignment = .TextXAlignment.Center
StatusLabel.Parent = ContentFrame
ToggleOnSound = .()
ToggleOnSound.Name =
ToggleOnSound.SoundId =
ToggleOnSound.Volume =
ToggleOnSound.PlaybackSpeed =
ToggleOnSound.Parent = ScreenGui
ToggleOffSound = .()
ToggleOffSound.Name =
ToggleOffSound.SoundId =
ToggleOffSound.Volume =
ToggleOffSound.PlaybackSpeed =
ToggleOffSound.Parent = ScreenGui
dragging =
dragInput =
dragStart =
startPos =
(input)
dragging
delta = input.Position - dragStart
MainFrame.Position = .(
startPos.X.Scale,
startPos.X.Offset + delta.X,
startPos.Y.Scale,
startPos.Y.Offset + delta.Y
)
MainFrame.InputBegan:((input)
input.UserInputType == .UserInputType.MouseButton1
input.UserInputType == .UserInputType.Touch
absolutePos = ToggleTrack.AbsolutePosition
absoluteSize = ToggleTrack.AbsoluteSize
inputPos = input.Position
inputPos.X >= absolutePos.X
inputPos.X <= absolutePos.X + absoluteSize.X
inputPos.Y >= absolutePos.Y
inputPos.Y <= absolutePos.Y + absoluteSize.Y
dragging =
dragStart = input.Position
startPos = MainFrame.Position
input.Changed:(()
input.UserInputState == .UserInputState.End
dragging =
)
)
MainFrame.InputChanged:((input)
input.UserInputType == .UserInputType.MouseMovement
input.UserInputType == .UserInputType.Touch
dragInput = input
)
UserInputService.InputChanged:((input)
input == dragInput
(input)
)
()
character = LocalPlayer.Character
character
humanoidRootPart = character:()
humanoidRootPart
bodyVelocity bodyVelocity:()
bodyGyro bodyGyro:()
bodyVelocity = .()
bodyVelocity.Name =
bodyVelocity.MaxForce = .(, , )
bodyVelocity.Velocity = .(, , )
bodyVelocity.P =
bodyVelocity.Parent = humanoidRootPart
bodyGyro = .()
bodyGyro.Name =
bodyGyro.MaxTorque = .(, , )
bodyGyro.P =
bodyGyro.D =
bodyGyro.Parent = humanoidRootPart
()
bodyVelocity
bodyVelocity:()
bodyVelocity =
bodyGyro
bodyGyro:()
bodyGyro =
()
isEnabled = isEnabled
tweenInfo = TweenInfo.(, .EasingStyle.Back, .EasingDirection.Out)
isEnabled
()
TweenService:(ToggleKnob, tweenInfo, {
Position = .(, , , -),
BackgroundColor3 = .(, , )
}):()
TweenService:(ToggleTrack, tweenInfo, {
BackgroundColor3 = .(, , )
}):()
TweenService:(TrackStroke, tweenInfo, {
Color = .(, , )
}):()
StatusLabel.Text =
TweenService:(StatusLabel, tweenInfo, {
TextColor3 = .(, , )
}):()
ToggleOnSound:()
()
TweenService:(ToggleKnob, tweenInfo, {
Position = .(, , , -),
BackgroundColor3 = .(, , )
}):()
TweenService:(ToggleTrack, tweenInfo, {
BackgroundColor3 = .(, , )
}):()
TweenService:(TrackStroke, tweenInfo, {
Color = .(, , )
}):()
StatusLabel.Text =
TweenService:(StatusLabel, tweenInfo, {
TextColor3 = .(, , )
}):()
ToggleOffSound:()
currentVelocity = .(, , )
targetVelocity = .(, , )
currentWaypoints = {}
ToggleTrack.InputBegan:((input)
input.UserInputType == .UserInputType.MouseButton1
input.UserInputType == .UserInputType.Touch
()
)
gradientAngle =
glowPhase =
RunService.RenderStepped:((dt)
gradientAngle = (gradientAngle + dt * ) %
MainGradient.Rotation = gradientAngle
glowPhase = glowPhase + dt
glow1X = + .(glowPhase * ) *
glow1Y = + .(glowPhase * ) *
GlowOrb.Position = .(glow1X, , glow1Y, )
GlowOrb.BackgroundTransparency = + .(glowPhase * ) *
glow2X = + .(glowPhase * ) *
glow2Y = + .(glowPhase * ) *
GlowOrb2.Position = .(glow2X, , glow2Y, )
GlowOrb2.BackgroundTransparency = + .(glowPhase * ) *
TitleGradient.Offset = .(.(glowPhase * ) * , )
)
()
character = LocalPlayer.Character
character , .huge
humanoidRootPart = character:()
humanoidRootPart , .huge
myPosition = humanoidRootPart.Position
nearestPlayer =
nearestDistance = .huge
_, player (Players:())
player ~= LocalPlayer
otherCharacter = player.Character
otherCharacter
otherHRP = otherCharacter:()
otherHRP
distance = (myPosition - otherHRP.Position).Magnitude
distance < nearestDistance
nearestDistance = distance
nearestPlayer = player
nearestPlayer, nearestDistance
(origin, direction, distance)
direction.Magnitude <
raycastParams = RaycastParams.()
raycastParams.FilterType = .RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {LocalPlayer.Character}
result = :(origin, direction.Unit * distance, raycastParams)
result ~= , result
(myPos, threatPos)
baseDirection = (myPos - threatPos)
baseDirection = .(baseDirection.X, , baseDirection.Z)
baseDirection.Magnitude <
baseDirection = .(, , )
baseDirection = baseDirection.Unit
testAngles = {, , -, , -, , -, , -, , -, , -}
bestDirection = baseDirection
bestScore = -.huge
needsJump =
_, angle (testAngles)
rad = .(angle)
testDir = .(
baseDirection.X * .(rad) - baseDirection.Z * .(rad),
,
baseDirection.X * .(rad) + baseDirection.Z * .(rad)
)
lowBlocked = (myPos + .(, , ), testDir, )
midBlocked = (myPos + .(, , ), testDir, )
highBlocked = (myPos + .(, , ), testDir, )
score = - .(angle)
lowBlocked
score = score +
midBlocked
score = score +
needsJump =
highBlocked
score = score +
score = score -
dotProduct = testDir:(baseDirection)
score = score + dotProduct *
score > bestScore
bestScore = score
bestDirection = testDir
lowBlocked
needsJump =
bestDirection.Unit, needsJump
(myPos, direction)
direction.Magnitude <
raycastParams = RaycastParams.()
raycastParams.FilterType = .RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {LocalPlayer.Character}
lowHit = :(myPos + .(, , ), direction.Unit * , raycastParams)
lowHit
highCheck = :(myPos + .(, , ), direction.Unit * , raycastParams)
highCheck
pathfindingAgent = PathfindingService:({
AgentRadius = ,
AgentHeight = ,
AgentCanJump = ,
AgentJumpHeight = ,
AgentMaxSlope = ,
Costs = { Water = }
})
(myPos, threatPos)
character = LocalPlayer.Character
character
escapeDir = (myPos - threatPos)
escapeDir = .(escapeDir.X, , escapeDir.Z)
escapeDir.Magnitude <
escapeDir = .(, , )
escapeDir = escapeDir.Unit
targetPos = myPos + escapeDir *
success = (()
pathfindingAgent:(myPos, targetPos)
)
success pathfindingAgent.Status == .PathStatus.Success
currentWaypoints = pathfindingAgent:()
currentWaypointIndex =
lastPathfindTime = ()
(direction, shouldJump, dt)
character = LocalPlayer.Character
character
humanoid = character:()
humanoidRootPart = character:()
humanoid humanoidRootPart
humanoid.Health <=
bodyVelocity bodyVelocity.Parent
()
direction.Magnitude >
targetVelocity = direction.Unit * CONFIG.MOVE_SPEED
targetVelocity = .(, , )
currentVelocity = currentVelocity:(targetVelocity, CONFIG.SMOOTHING_FACTOR)
currentVelocity.Magnitude >
bodyVelocity.MaxForce = .(, , )
bodyVelocity.Velocity = .(currentVelocity.X, , currentVelocity.Z)
bodyVelocity.MaxForce = .(, , )
bodyVelocity.Velocity = .(, , )
shouldJump (() - lastJumpTime) > CONFIG.JUMP_COOLDOWN
humanoid.FloorMaterial ~= .Material.Air
humanoid:(.HumanoidStateType.Jumping)
lastJumpTime = ()
(targetPlayer)
character = LocalPlayer.Character
character
humanoidRootPart = character:()
targetCharacter = targetPlayer.Character
humanoidRootPart targetCharacter
targetHRP = targetCharacter:()
targetHRP
bodyGyro bodyGyro.Parent
()
lookDir = (targetHRP.Position - humanoidRootPart.Position)
lookDir = .(lookDir.X, , lookDir.Z)
lookDir.Magnitude <
bodyGyro.MaxTorque = .(, , )
bodyGyro.CFrame = .(humanoidRootPart.Position, humanoidRootPart.Position + lookDir)
()
bodyGyro bodyGyro.Parent
bodyGyro.MaxTorque = .(, , )
()
targetVelocity = .(, , )
bodyVelocity bodyVelocity.Parent
bodyVelocity.MaxForce = .(, , )
bodyVelocity.Velocity = .(, , )
currentVelocity = currentVelocity:(.(, , ), )
RunService.Heartbeat:((dt)
isEnabled
()
character = LocalPlayer.Character
character
humanoidRootPart = character:()
humanoid = character:()
humanoidRootPart humanoid
humanoid.Health <=
myPosition = humanoidRootPart.Position
nearestPlayer, distance = ()
nearestPlayer distance <= CONFIG.DETECTION_RADIUS
targetCharacter = nearestPlayer.Character
targetCharacter
targetHRP = targetCharacter:()
targetHRP
threatPosition = targetHRP.Position
distance <= CONFIG.FLEE_RADIUS
()
escapeDirection, needsJump = (myPosition, threatPosition)
directPathBlocked = (
myPosition + .(, , ),
escapeDirection,
)
directPathBlocked
() - lastPathfindTime > CONFIG.PATHFIND_TIMEOUT
(myPosition, threatPosition)
#currentWaypoints > currentWaypointIndex <= #currentWaypoints
waypoint = currentWaypoints[currentWaypointIndex]
waypointDir = (waypoint.Position - myPosition)
waypointDir = .(waypointDir.X, , waypointDir.Z)
waypointDir.Magnitude >
shouldJumpWaypoint = waypoint.Action == .PathWaypointAction.Jump
(waypointDir.Unit, shouldJumpWaypoint, dt)
currentWaypointIndex = currentWaypointIndex +
needsJump = needsJump (myPosition, escapeDirection)
(escapeDirection, needsJump, dt)
needsJump = needsJump (myPosition, escapeDirection)
(escapeDirection, needsJump, dt)
currentWaypoints = {}
()
(nearestPlayer)
()
()
currentWaypoints = {}
)
LocalPlayer.CharacterAdded:((newCharacter)
newCharacter:()
newCharacter:()
isEnabled
()
()
)
ScreenGui.Destroying:(()
isEnabled =
()
)
()
()
()
Universal