ADVERTISEMENTREMOVE ADS
Game icon

Orbit Player And Stuff

Just a baseplate.
2 months ago
Script preview thumbnail
Script Preview
ADVERTISEMENTREMOVE ADS
244 Lines • 6.79 KiB
Raw
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local TextChatService = game:GetService("TextChatService")
local HOVER_HEIGHT = 10
local ORBIT_RADIUS = 10
local ORBIT_SPEED = 2
local BP_P = 8000
local BP_D = 1000
local BG_P = 4000
local BG_D = 1000
local MAX_FORCE = 1e6
local activeParts = {}
local angleOffsets = {}
local levitateApplied = false
local orbitTarget = nil
local hoveredPlayer = nil
local highlight = nil
local function clearHighlight()
if highlight then
highlight:Destroy()
highlight = nil
end
end
local function clearParts()
for part, data in pairs(activeParts) do
if data.bp then data.bp:Destroy() end
if data.bg then data.bg:Destroy() end
end
activeParts = {}
angleOffsets = {}
levitateApplied = false
end
local function makeParts(character)
if levitateApplied then return end
levitateApplied = true
local root = character:FindFirstChild("HumanoidRootPart")
if not root then return end
for _, part in ipairs(character:GetDescendants()) do
if part:IsA("BasePart") then
part.Anchored = false
part.CanCollide = true
part.Massless = false
local bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(MAX_FORCE, MAX_FORCE, MAX_FORCE)
bp.P = BP_P
bp.D = BP_D
bp.Position = part.Position
bp.Parent = part
local bg = Instance.new("BodyGyro")
bg.MaxTorque = Vector3.new(MAX_FORCE, MAX_FORCE, MAX_FORCE)
bg.P = BG_P
bg.D = BG_D
bg.CFrame = part.CFrame
bg.Parent = part
activeParts[part] = {bp=bp,bg=bg}
angleOffsets[part] = math.random() * math.pi * 2
end
end
end
local function onCharacterAdded(chr)
TextChatService.TextChannels.RBXGeneral:SendAsync("-pd")
wait(0.5)
chr:BreakJoints()
wait(0.2)
makeParts(chr)
end
player.CharacterRemoving:Connect(function()
clearParts()
end)
player.CharacterAdded:Connect(function(chr)
wait(1)
onCharacterAdded(chr)
end)
if player.Character then
onCharacterAdded(player.Character)
end
local screenGui = Instance.new("ScreenGui")
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0,300,0,300)
frame.Position = UDim2.new(0.5, -150, 0.5, -75)
frame.BackgroundColor3 = Color3.fromRGB(35,35,35)
frame.BorderSizePixel = 0
frame.Parent = screenGui
frame.Active = true
frame.Draggable = true
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1,0,0,30)
title.BackgroundTransparency = 1
title.Text = "shitty orbit"
title.TextColor3 = Color3.fromRGB(255,255,255)
title.Font = Enum.Font.GothamBold
title.TextScaled = true
title.Parent = frame
local followButton = Instance.new("TextButton")
followButton.Size = UDim2.new(0,260,0,40)
followButton.Position = UDim2.new(0,20,0,40)
followButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
followButton.TextColor3 = Color3.new(1,1,1)
followButton.Text = "orbit player"
followButton.Font = Enum.Font.Gotham
followButton.TextScaled = true
followButton.Parent = frame
local shapeButton = Instance.new("TextButton")
shapeButton.Size = UDim2.new(0,260,0,40)
shapeButton.Position = UDim2.new(0,20,0,90)
shapeButton.BackgroundColor3 = Color3.fromRGB(80,80,80)
shapeButton.TextColor3 = Color3.new(1,1,1)
shapeButton.Text = "goofy circle"
shapeButton.Font = Enum.Font.Gotham
shapeButton.TextScaled = true
shapeButton.Parent = frame
local reset = Instance.new("TextButton")
reset.Size = UDim2.new(0,260,0,40)
reset.Position = UDim2.new(0,20,0,140)
reset.BackgroundColor3 = Color3.fromRGB(80,80,80)
reset.TextColor3 = Color3.new(1,1,1)
reset.Text = "reset"
reset.Font = Enum.Font.Gotham
reset.TextScaled = true
reset.Parent = frame
reset.MouseButton1Click:Connect(function()
TextChatService.TextChannels.RBXGeneral:SendAsync("-re")
end)
followButton.MouseButton1Click:Connect(function()
for _, p in ipairs(Players:GetPlayers()) do
if p ~= player and p.Character then
orbitTarget = p
break
end
end
end)
shapeButton.MouseButton1Click:Connect(function()
orbitTarget = nil
local partsList = {}
for part, _ in pairs(activeParts) do
table.insert(partsList, part)
end
local n = #partsList
for i, part in ipairs(partsList) do
local angle = i/n * math.pi * 2
local radius = ORBIT_RADIUS
if part:IsA("BasePart") then
activeParts[part].bp.Position = Vector3.new(math.cos(angle)*radius,HOVER_HEIGHT,math.sin(angle)*radius)
end
end
end)
RunService.Heartbeat:Connect(function()
local character = player.Character
if not character then return end
local root = character:FindFirstChild("HumanoidRootPart")
if not root then return end
if orbitTarget and orbitTarget.Character then
local targetRoot = orbitTarget.Character:FindFirstChild("HumanoidRootPart")
if targetRoot then
local t = tick()
for part, data in pairs(activeParts) do
local angle = t * ORBIT_SPEED + angleOffsets[part]
local radius = ORBIT_RADIUS
local x = math.cos(angle) * radius
local z = math.sin(angle) * radius
local yOffset = HOVER_HEIGHT
if targetRoot.Parent:FindFirstChild("Humanoid") then
local hum = targetRoot.Parent.Humanoid
if hum.RigType == Enum.HumanoidRigType.R15 then
yOffset = 3
else
yOffset = 2
end
end
local targetPos = targetRoot.Position + Vector3.new(x,yOffset,z)
if data.bp and data.bp.Parent then
data.bp.Position = targetPos
end
if data.bg and data.bg.Parent then
data.bg.CFrame = CFrame.new(targetPos)
end
end
end
else
for part, data in pairs(activeParts) do
if data.bp and data.bp.Parent then
data.bp.Position = root.Position + Vector3.new(0,HOVER_HEIGHT,0)
end
if data.bg and data.bg.Parent then
data.bg.CFrame = part.CFrame
end
end
end
local target = nil
for _, p in ipairs(Players:GetPlayers()) do
if p ~= player and p.Character then
for _, part in ipairs(p.Character:GetDescendants()) do
if part:IsA("BasePart") then
local screenPos, onScreen = workspace.CurrentCamera:WorldToViewportPoint(part.Position)
local mousePos = Vector2.new(mouse.X, mouse.Y)
if onScreen and (Vector2.new(screenPos.X,screenPos.Y)-mousePos).Magnitude < 50 then
target = p
break
end
end
end
if target then break end
end
end
if target ~= hoveredPlayer then
hoveredPlayer = target
clearHighlight()
if hoveredPlayer and hoveredPlayer.Character then
highlight = Instance.new("Highlight")
highlight.Adornee = hoveredPlayer.Character
highlight.Parent = workspace
end
end
end)
mouse.Button1Down:Connect(function()
if hoveredPlayer then
orbitTarget = hoveredPlayer
end
end)
ADVERTISEMENTREMOVE ADS

Comments

0 comments
to add a comment
Loading comments
ADVERTISEMENTREMOVE ADS