-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFE-Orbit
More file actions
116 lines (98 loc) · 3.09 KB
/
FE-Orbit
File metadata and controls
116 lines (98 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--[[
t.me/arceusxscripts
]]
local OrionLib = loadstring(game:HttpGet('https://pastebin.com/raw/WRUyYTdY'))()
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local orbitDistance = 10
local orbitSpeed = 2
local orbitAngle = 0
local targetPlayerName = ""
local isOrbiting = false
local Window = OrionLib:MakeWindow({Name = "Orbit Player", HidePremium = false, SaveConfig = true, ConfigFolder = "OrbitPlayer"})
local OrbitTab = Window:MakeTab({
Name = "Orbit Controls",
Icon = "rbxassetid://4483345998",
PremiumOnly = false
})
local function updatePlayerDropdown()
local playerNames = {}
for _, otherPlayer in pairs(Players:GetPlayers()) do
table.insert(playerNames, otherPlayer.Name)
end
return playerNames
end
OrbitTab:AddDropdown({
Name = "Select Player",
Default = "",
Options = updatePlayerDropdown(),
Callback = function(Value)
targetPlayerName = Value
end
})
OrbitTab:AddTextbox({
Name = "Orbit Speed",
Default = "2",
TextDisappear = true,
Callback = function(Value)
local newSpeed = tonumber(Value)
if newSpeed then
orbitSpeed = newSpeed
else
OrionLib:MakeNotification({
Name = "Invalid Input",
Content = "Please enter a valid number for orbit speed.",
Image = "rbxassetid://4483345998",
Time = 5
})
end
end
})
OrbitTab:AddToggle({
Name = "Toggle Orbit",
Default = false,
Callback = function(Value)
isOrbiting = Value
end
})
local function getPlayerByName(name)
for _, otherPlayer in pairs(Players:GetPlayers()) do
if otherPlayer.Name == name then
return otherPlayer
end
end
return nil
end
RunService.Heartbeat:Connect(function(deltaTime)
if not isOrbiting then return end
local targetPlayer = getPlayerByName(targetPlayerName)
if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
-- Update orbit angle
orbitAngle = orbitAngle + orbitSpeed * deltaTime
-- Calculate new position
local offset = Vector3.new(
math.cos(orbitAngle) * orbitDistance,
0,
math.sin(orbitAngle) * orbitDistance
)
-- Set new position and orientation
humanoidRootPart.CFrame = CFrame.new(targetPosition + offset) * CFrame.Angles(0, orbitAngle + math.pi/2, 0)
end
end)
Players.PlayerAdded:Connect(function()
OrbitTab:UpdateDropdown({
Name = "Select Player",
Options = updatePlayerDropdown()
})
end)
Players.PlayerRemoving:Connect(function()
OrbitTab:UpdateDropdown({
Name = "Select Player",
Options = updatePlayerDropdown()
})
end)
OrionLib:Init()