SHOW:
|
|
- or go back to the newest paste.
1 | -- Set prefix here! | |
2 | -- Synapse X Required for save command. | |
3 | -- How to use: | |
4 | -- https://youtu.be/sjsPKvfODlM | |
5 | local prefix = ";"; | |
6 | ||
7 | --[[ | |
8 | If you have a custom prefix, remember to put it first instead of ; | |
9 | ||
10 | Commands: | |
11 | ||
12 | save -- Saves Camera's and Waypoints (auto loads when executed again) | |
13 | load -- Loads your save (it auto does this lol) | |
14 | ||
15 | Movement Commands: | |
16 | ||
17 | tp player/displayname -- Teleports you to a player | |
18 | rtp player/displayname -- Resets you then teleports you to the player (bypasses some anticheats) | |
19 | tptocam -- Teleports you to your camera | |
20 | follow player/displayname -- Follows a player | |
21 | annoy player/displayname -- Annoys a player | |
22 | unfollow -- Stops following | |
23 | unannoy -- Stops annoying | |
24 | ||
25 | Visual Commands: | |
26 | ||
27 | view player/displayname -- Spectates a player | |
28 | unview -- Stops spectating | |
29 | createcam -- Creates a camera where your looking | |
30 | viewcam -- View from the camera | |
31 | destroycam -- Destroys current camera | |
32 | camview player/displayname -- Changes your view to the closest non obstructed camera faced at the player | |
33 | camwaypoints on/off -- Toggles camera waypoints | |
34 | next -- Cycles through cameras | |
35 | last -- Cycles back through cameras | |
36 | unviewcameras -- Stops viewing cameras | |
37 | freecam on/off -- Toggles freecam | |
38 | - | local activeObjects = Instance.new("Folder",workspace) |
38 | + | |
39 | - | local waypoint_Folder = Instance.new("Folder",activeObjects); |
39 | + | |
40 | - | local camera_Folder = Instance.new("Folder", activeObjects) |
40 | + | |
41 | ]] | |
42 | ||
43 | - | camera_Folder.Name = math.random(1,100) |
43 | + | |
44 | - | waypoint_Folder.Name = math.random(1,100); |
44 | + | |
45 | - | activeObjects.Name = math.random(1,100) |
45 | + | |
46 | local UIS = game:GetService("UserInputService"); | |
47 | _G.activeObjects = Instance.new("Folder",workspace) | |
48 | _G.waypoint_Folder = Instance.new("Folder",_G.activeObjects); | |
49 | _G.camera_Folder = Instance.new("Folder", _G.activeObjects) | |
50 | ||
51 | - | local active_Objects = { |
51 | + | |
52 | _G.camera_Folder.Name = math.random(1,100) | |
53 | _G.waypoint_Folder.Name = math.random(1,100); | |
54 | _G.activeObjects.Name = math.random(1,100) | |
55 | ||
56 | -- Loop Table | |
57 | local looped_Commands = {}; | |
58 | local CamerasNotObstructed = {} | |
59 | ||
60 | -- Tables | |
61 | - | ActiveWaypoints = {}, |
61 | + | _G.active_Objects = { |
62 | Cameras = { | |
63 | Name = "Cameras", | |
64 | ClassName = "CameraService", | |
65 | Active = false, | |
66 | Watching = false, | |
67 | CameraPosition = 0, | |
68 | ActiveCamera = 0, | |
69 | ActiveCameras = {}, | |
70 | CameraPoints = {}, | |
71 | viewEnded = { | |
72 | Connected_Functions = {}, | |
73 | Connect = function(p1) | |
74 | table.insert(_G.active_Objects.Cameras.viewEnded.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
75 | end, | |
76 | Disconnect = function(p1) | |
77 | for _,p2 in pairs(_G.active_Objects.Cameras.viewEnded.Connected_Functions) do | |
78 | if p2.ID == tostring(p1) then | |
79 | table.remove(_G.active_Objects.Cameras.viewEnded.Connected_Functions,_) | |
80 | - | function getPlayer(data) |
80 | + | |
81 | end | |
82 | end, | |
83 | - | if p2.Name ~= Player.Name then |
83 | + | }, |
84 | - | if string.sub(p2.Name:lower(), 1,#data) == p1 or string.sub(p2.DisplayName:lower(), 1,#data) == p1 then |
84 | + | viewBegan = { |
85 | - | return true, p2 |
85 | + | Connected_Functions = {}, |
86 | Connect = function(p1) | |
87 | table.insert(_G.active_Objects.Cameras.viewBegan.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
88 | end, | |
89 | Disconnect = function(p1) | |
90 | for _,p2 in pairs(_G.active_Objects.Cameras.viewBegan.Connected_Functions) do | |
91 | if p2.ID == tostring(p1) then | |
92 | - | local p1 = Instance.new("Part",waypoint_Folder); |
92 | + | table.remove(_G.active_Objects.Cameras.viewBegan.Connected_Functions,_) |
93 | end | |
94 | end | |
95 | end, | |
96 | }, | |
97 | PositionChanged = { | |
98 | Connected_Functions = {}, | |
99 | Connect = function(p1) | |
100 | table.insert(_G.active_Objects.Cameras.PositionChanged.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
101 | end, | |
102 | Disconnect = function(p1) | |
103 | for _,p2 in pairs(_G.active_Objects.Cameras.PositionChanged.Connected_Functions) do | |
104 | if p2.ID == tostring(p1) then | |
105 | table.remove(_G.active_Objects.Cameras.PositionChanged.Connected_Functions,_) | |
106 | end | |
107 | end | |
108 | end, | |
109 | }, | |
110 | Created = { | |
111 | Connected_Functions = {}, | |
112 | Connect = function(p1) | |
113 | table.insert(_G.active_Objects.Cameras.Created.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
114 | end, | |
115 | Disconnect = function(p1) | |
116 | for _,p2 in pairs(_G.active_Objects.Cameras.Created.Connected_Functions) do | |
117 | if p2.ID == tostring(p1) then | |
118 | table.remove(_G.active_Objects.Cameras.Created.Connected_Functions,_) | |
119 | end | |
120 | - | if active_Objects.Freecam.Active == true then |
120 | + | |
121 | - | p1.CFrame = activeObjects:FindFirstChild("Freecam").CFrame |
121 | + | end, |
122 | }, | |
123 | }, | |
124 | Waypoints = { | |
125 | - | table.insert(active_Objects.Waypoints.ActiveWaypoints, {Type="Waypoint",Subject=p1}) |
125 | + | Name = "Waypoints", |
126 | - | active_Objects.Waypoints.ActiveWaypoint = active_Objects.Waypoints.ActiveWaypoint + 1 |
126 | + | ClassName = "WaypointService", |
127 | ActiveWaypoint = 0, | |
128 | ActiveWaypoints = {}, | |
129 | - | local function createCamera() |
129 | + | |
130 | - | local p1 = Instance.new('Part',camera_Folder) |
130 | + | Created = { |
131 | Connected_Functions = {}, | |
132 | Connect = function(p1) | |
133 | table.insert(_G.active_Objects.Waypoints.Created.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
134 | end, | |
135 | Disconnect = function(p1) | |
136 | - | local p5 = Instance.new("Part",camera_Folder); |
136 | + | for _,p2 in pairs(_G.active_Objects.Waypoints.Created.Connected_Functions) do |
137 | if p2.ID == tostring(p1) then | |
138 | table.remove(_G.active_Objects.Waypoints.Created.Connected_Functions,_) | |
139 | end | |
140 | end | |
141 | end, | |
142 | }, | |
143 | Destroyed = { | |
144 | Connected_Functions = {}, | |
145 | Connect = function(p1) | |
146 | table.insert(_G.active_Objects.Waypoints.Destroyed.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
147 | end, | |
148 | Disconnect = function(p1) | |
149 | for _,p2 in pairs(_G.active_Objects.Waypoints.Destroyed.Connected_Functions) do | |
150 | if p2.ID == tostring(p1) then | |
151 | table.remove(_G.active_Objects.Waypoints.Destroyed.Connected_Functions,_) | |
152 | end | |
153 | end | |
154 | end, | |
155 | } | |
156 | }, | |
157 | Freecam = { | |
158 | Name = "Freecam", | |
159 | ClassName = "FreecamService", | |
160 | - | table.insert(active_Objects.Cameras.CameraPoints,{Type="Waypoint",Target=p5,Extra=p4}) |
160 | + | |
161 | - | table.insert(active_Objects.Cameras.ActiveCameras, {Type="Camera",Target=p1}) |
161 | + | Activated = { |
162 | - | active_Objects.Cameras.ActiveCamera = active_Objects.Cameras.ActiveCamera + 1 |
162 | + | Connected_Functions = {}, |
163 | - | p4.Text = "Camera" .. active_Objects.Cameras.ActiveCamera |
163 | + | Connect = function(p1) |
164 | table.insert(_G.active_Objects.Freecam.Activated.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
165 | end, | |
166 | Disconnect = function(p1) | |
167 | for _,p2 in pairs(_G.active_Objects.Freecam.Activated.Connected_Functions) do | |
168 | if p2.ID == tostring(p1) then | |
169 | - | if isfolder("FXAdmin") then |
169 | + | table.remove(_G.active_Objects.Freecam.Activated.Connected_Functions,_) |
170 | - | if isfile("FXAdmin/" .. GameName .. ".lua") then |
170 | + | |
171 | - | local load = loadfile("FXAdmin/" .. GameName .. ".lua") |
171 | + | |
172 | - | load() |
172 | + | end, |
173 | - | end |
173 | + | }, |
174 | - | else |
174 | + | Disabled = { |
175 | - | makefolder("FXAdmin") |
175 | + | Connected_Functions = {}, |
176 | Connect = function(p1) | |
177 | table.insert(_G.active_Objects.Freecam.Disabled.Connected_Functions,{Func=p1,ID=tostring(p1)}) | |
178 | end, | |
179 | - | local data = "\nFXDuke save for "..GameName .. ".\n\nif game.GameId == " .. game.GameId .. " then" |
179 | + | Disconnect = function(p1) |
180 | - | for _,p1 in pairs(active_Objects.Waypoints.ActiveWaypoints) do |
180 | + | for _,p2 in pairs(_G.active_Objects.Freecam.Disabled.Connected_Functions) do |
181 | - | data = data .. " local w".. _ .." = Instance.new(" .. p1.Target.className .. ",waypoint_Folder)\n" |
181 | + | if p2.ID == tostring(p1) then |
182 | - | data = data .. " table.insert(active_Objects.Waypoints.ActiveWaypoints, {Type='Waypoint',Subject= w" .. _ .. "})\n" |
182 | + | table.remove(_G.active_Objects.Freecam.Disabled.Connected_Functions,_) |
183 | - | data = data .. " w" .. _ .. ".CFrame = CFrame.new(" .. p1.Target.CFrame .. ")\n" |
183 | + | |
184 | - | for x,z in pairs(p1.Target:GetDescendants()) do |
184 | + | |
185 | - | local p2 |
185 | + | end, |
186 | - | if x == 1 then |
186 | + | } |
187 | - | p2 = "" |
187 | + | |
188 | - | else |
188 | + | Viewing = Player.Character:FindFirstChildOfClass("Humanoid"), |
189 | - | p2 = "_" .. 1*(x-1) |
189 | + | |
190 | - | end |
190 | + | _G.active_Objects.GetService = function(p1) |
191 | - | data = data .. " local w".. _ .."_" .. x .. " = Instance.new(" .. z.className .. ",w".. _ .. p2 ..")\n" |
191 | + | local a,b = pcall(function() |
192 | - | end |
192 | + | for _,v in pairs(_G.active_Objects) do |
193 | - | end |
193 | + | if type(v) == "table" then |
194 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
194 | + | if v.ClassName == p1 then |
195 | - | data = data .. " local c".. _ .." = Instance.new(" .. p1.Target.className .. ",camera_Folder)\n" |
195 | + | return v; |
196 | - | data = data .. " table.insert(active_Objects.Cameras.ActiveCameras, {Type='Camera',Target=c" .. _ .. "})\n" |
196 | + | |
197 | - | data = data .. " c" .. _ .. ".CFrame = CFrame.new(" .. p1.Target.CFrame .. ")\n" |
197 | + | |
198 | - | end |
198 | + | |
199 | - | for _,p1 in pairs(active_Objects.Cameras.CameraPoints) do |
199 | + | end) |
200 | - | local p2 = false |
200 | + | if not a then error(b) end |
201 | - | for a,x in pairs(p1:GetDescendants()) do |
201 | + | |
202 | - | if x:IsA("Frame") then |
202 | + | local AO = _G.active_Objects |
203 | - | p2 = true |
203 | + | |
204 | - | end |
204 | + | -- Guis |
205 | - | end |
205 | + | -- Camera Gui |
206 | - | if p2 == true then |
206 | + | -- Instances: |
207 | - | data = data .. " local cw".. _ .." = Instance.new(" .. p1.Target.className .. ",camera_Folder)\n" |
207 | + | |
208 | - | data = data .. " table.insert(active_Objects.Waypoints.ActiveWaypoints, {Type='Waypoint',Subject= cw" .. _ .. "})\n" |
208 | + | local CameraViewGui = Instance.new("ScreenGui") |
209 | - | data = data .. " cw" .. _ .. ".CFrame = CFrame.new(" .. p1.Target.CFrame .. ")\n" |
209 | + | local Holder = Instance.new("Frame") |
210 | - | for x,z in pairs(p1.Target:GetDescendants()) do |
210 | + | local RightButton = Instance.new("TextButton") |
211 | - | local p2 |
211 | + | local LeftButton = Instance.new("TextButton") |
212 | - | if x == 1 then |
212 | + | local Seperator = Instance.new("Frame") |
213 | - | p2 = "" |
213 | + | local CameraText = Instance.new("TextLabel") |
214 | - | else |
214 | + | local CameraName = Instance.new("TextLabel") |
215 | - | p2 = "_" .. 1*(x-1) |
215 | + | local UIStrokeHolder = Instance.new("Frame") |
216 | - | end |
216 | + | local UIStroke = Instance.new("UIStroke") |
217 | - | data = data .. " local cw".. _ .."_" .. x .. " = Instance.new(" .. z.className .. ",cw".. _ .. p2 ..")\n" |
217 | + | |
218 | - | end |
218 | + | --Properties: |
219 | - | end |
219 | + | |
220 | - | end |
220 | + | CameraViewGui.Name = "CameraViewGui" |
221 | - | data = data .. "\nend" |
221 | + | CameraViewGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") |
222 | - | writefile("FXAdmin/" .. GameName .. ".lua", data) |
222 | + | CameraViewGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling |
223 | ||
224 | Holder.Name = "Holder" | |
225 | Holder.Parent = CameraViewGui | |
226 | Holder.BackgroundColor3 = Color3.fromRGB(34, 34, 34) | |
227 | Holder.BorderSizePixel = 0 | |
228 | Holder.Visible = false | |
229 | Holder.Position = UDim2.new(0.407319009, 0, 0.0261682235, 0) | |
230 | Holder.Size = UDim2.new(0, 286, 0, 100) | |
231 | ||
232 | RightButton.Name = "RightButton" | |
233 | RightButton.Parent = Holder | |
234 | RightButton.BackgroundColor3 = Color3.fromRGB(34, 34, 34) | |
235 | RightButton.BorderColor3 = Color3.fromRGB(0, 0, 0) | |
236 | RightButton.Position = UDim2.new(0.99992907, 0, 0, 0) | |
237 | RightButton.Size = UDim2.new(0, 167, 0, 100) | |
238 | RightButton.AutoButtonColor = false | |
239 | RightButton.Font = Enum.Font.SourceSans | |
240 | RightButton.Text = ">" | |
241 | RightButton.TextColor3 = Color3.fromRGB(159, 159, 159) | |
242 | RightButton.TextScaled = true | |
243 | RightButton.TextSize = 100.000 | |
244 | RightButton.TextStrokeTransparency = 0.730 | |
245 | RightButton.TextTransparency = 0.440 | |
246 | RightButton.TextWrapped = true | |
247 | ||
248 | LeftButton.Name = "LeftButton" | |
249 | LeftButton.Parent = Holder | |
250 | LeftButton.BackgroundColor3 = Color3.fromRGB(34, 34, 34) | |
251 | LeftButton.BorderColor3 = Color3.fromRGB(0, 0, 0) | |
252 | LeftButton.Position = UDim2.new(-0.585042536, 0, 0, 0) | |
253 | LeftButton.Size = UDim2.new(0, 167, 0, 100) | |
254 | LeftButton.AutoButtonColor = false | |
255 | LeftButton.Font = Enum.Font.SourceSans | |
256 | LeftButton.Text = "<" | |
257 | LeftButton.TextColor3 = Color3.fromRGB(159, 159, 159) | |
258 | LeftButton.TextScaled = true | |
259 | LeftButton.TextSize = 100.000 | |
260 | LeftButton.TextStrokeTransparency = 0.730 | |
261 | LeftButton.TextTransparency = 0.440 | |
262 | LeftButton.TextWrapped = true | |
263 | ||
264 | Seperator.Name = "Seperator" | |
265 | Seperator.Parent = Holder | |
266 | Seperator.BackgroundColor3 = Color3.fromRGB(0, 0, 0) | |
267 | Seperator.BackgroundTransparency = 0.600 | |
268 | Seperator.BorderSizePixel = 0 | |
269 | - | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") or Player.Character.HumanoidRootPart or Player.Character:FindFirstChildOfClass("BasePart"); |
269 | + | Seperator.Position = UDim2.new(0.0209790207, 0, 0.300000012, 0) |
270 | - | active_Objects.Cameras.Active = true |
270 | + | Seperator.Size = UDim2.new(0, 271, 0, 3) |
271 | ||
272 | CameraText.Name = "CameraText" | |
273 | CameraText.Parent = Holder | |
274 | CameraText.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
275 | CameraText.BackgroundTransparency = 1.000 | |
276 | CameraText.Position = UDim2.new(-0.157342672, 0, 0, 0) | |
277 | CameraText.Size = UDim2.new(0, 200, 0, 33) | |
278 | CameraText.Font = Enum.Font.SourceSans | |
279 | CameraText.Text = "Currently Viewing:" | |
280 | CameraText.TextColor3 = Color3.fromRGB(208, 208, 208) | |
281 | CameraText.TextSize = 14.000 | |
282 | ||
283 | CameraName.Name = "CameraName" | |
284 | CameraName.Parent = Holder | |
285 | CameraName.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
286 | CameraName.BackgroundTransparency = 1.000 | |
287 | CameraName.Position = UDim2.new(0.433566391, 0, 0, 0) | |
288 | CameraName.Size = UDim2.new(0, 200, 0, 33) | |
289 | CameraName.Font = Enum.Font.SourceSans | |
290 | CameraName.Text = "PlaceHolder" | |
291 | CameraName.TextColor3 = Color3.fromRGB(208, 208, 208) | |
292 | CameraName.TextSize = 14.000 | |
293 | CameraName.TextXAlignment = Enum.TextXAlignment.Left | |
294 | ||
295 | UIStrokeHolder.Name = "UIStrokeHolder" | |
296 | UIStrokeHolder.Parent = Holder | |
297 | UIStrokeHolder.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
298 | UIStrokeHolder.BackgroundTransparency = 1.000 | |
299 | UIStrokeHolder.Position = UDim2.new(-0.585042477, 0, 0, 0) | |
300 | UIStrokeHolder.Size = UDim2.new(0, 620, 0, 100) | |
301 | ||
302 | UIStroke.Name = "UIStroke" | |
303 | UIStroke.LineJoinMode = Enum.LineJoinMode.Round | |
304 | UIStroke.Thickness = 2 | |
305 | UIStroke.Parent = UIStrokeHolder | |
306 | - | for _,p1 in pairs(waypoint_Folder:GetDescendants()) do |
306 | + | |
307 | -- Active Listeners | |
308 | local CS = AO.Cameras -- Camera Service | |
309 | CS.viewBegan.Connect(function(camera,camera_name) | |
310 | Holder.Visible = true | |
311 | CameraName.Text = camera_name | |
312 | end) | |
313 | - | for _,p1 in pairs(waypoint_Folder:GetDescendants()) do |
313 | + | CS.viewEnded.Connect(function() |
314 | Holder.Visible = false | |
315 | end) | |
316 | CS.PositionChanged.Connect(function(camera,camera_name) | |
317 | CameraName.Text = camera_name | |
318 | end) | |
319 | ||
320 | - | active_Objects.Waypoints.ActiveWaypoints = 0 |
320 | + | |
321 | - | for _,p1 in pairs(waypoint_Folder:GetChildren()) do |
321 | + | |
322 | local fcs = 50; -- Freecam Speed | |
323 | local tb = false; -- Typing began | |
324 | - | for _,p1 in pairs(active_Objects.Waypoints.ActiveWaypoints) do |
324 | + | |
325 | - | table.remove(active_Objects.Waypoints.ActiveWaypoints,_) |
325 | + | local Already_Loaded = false; |
326 | - | end |
326 | + | local RTP_TO = nil |
327 | ||
328 | -- Lower Functions | |
329 | local function stc(p1,p2) if string.sub(p1,1,#p2) == string.lower(p2) then return true; end; end; -- String to Command | |
330 | local function scs(p1) local p2 = string.split(p1," "); return true, p2[1] .. " ", p2[2]; end; -- String Seperate | |
331 | ||
332 | - | active_Objects.Freecam.Active = true |
332 | + | |
333 | - | if active_Objects.Cameras.Active == true then |
333 | + | local function getPlayer(data) |
334 | local p1 = data:lower() | |
335 | - | active_Objects.Cameras.Active = false |
335 | + | |
336 | --if p2.Name ~= Player.Name then | |
337 | if string.sub(p2.Name:lower(), 1,#data) == p1 or string.sub(p2.DisplayName:lower(), 1,#data) == p1 then | |
338 | return true, p2 | |
339 | end | |
340 | -- end | |
341 | end | |
342 | - | p1.Parent = activeObjects |
342 | + | |
343 | ||
344 | local dis2 = function(x1,x2,y1,y2,z1,z2) | |
345 | return math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))+((z2-z1)*(z2-z1))) | |
346 | end | |
347 | ||
348 | local function sendNotif(data) | |
349 | game:GetService("StarterGui"):SetCore("SendNotification", { | |
350 | Title = "FXAdmin 2.5", | |
351 | Text = data, | |
352 | Duration = 60, | |
353 | Button1 = "Ok", | |
354 | }) | |
355 | end | |
356 | ||
357 | - | active_Objects.Freecam.Active = false |
357 | + | local function next_cam() |
358 | if _G.active_Objects.Freecam.Active == true then | |
359 | for _,p1 in pairs(looped_Commands) do | |
360 | if p1.Type == "Freecam" then | |
361 | - | [prefix .. 'createcam '] = function() |
361 | + | p1.Target:Destroy(); |
362 | - | local p1 = createCamera() |
362 | + | |
363 | end; | |
364 | end; | |
365 | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") | |
366 | - | if active_Objects.Freecam.Active == true then |
366 | + | Player.Character.HumanoidRootPart.Anchored = false; |
367 | _G.active_Objects.Freecam.Active = false | |
368 | end | |
369 | if _G.active_Objects.Cameras.CameraPosition + 1 > _G.active_Objects.Cameras.ActiveCamera then | |
370 | _G.active_Objects.Cameras.CameraPosition = 1 | |
371 | else | |
372 | _G.active_Objects.Cameras.CameraPosition = _G.active_Objects.Cameras.CameraPosition + 1 | |
373 | end | |
374 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
375 | - | active_Objects.Freecam.Active = false |
375 | + | if _ == _G.active_Objects.Cameras.CameraPosition then |
376 | workspace.CurrentCamera.CameraSubject = p1.Target | |
377 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
377 | + | _G.active_Objects.Viewing = p1.Target |
378 | - | if _ == active_Objects.Cameras.CameraPosition then |
378 | + | if _G.active_Objects.Cameras.Active == false then |
379 | for _,v in pairs(_G.active_Objects.Cameras.viewBegan.Connected_Functions) do | |
380 | - | active_Objects.Cameras.Active = true |
380 | + | v.Func(p1.Target,p1.Extra) |
381 | end | |
382 | - | elseif active_Objects.Cameras.CameraPosition == 0 then |
382 | + | |
383 | for _,v in pairs(_G.active_Objects.Cameras.PositionChanged.Connected_Functions) do | |
384 | - | active_Objects.Cameras.CameraPosition = active_Objects.Cameras.CameraPosition + 1 |
384 | + | v.Func(p1.Target,p1.Extra) |
385 | - | active_Objects.Cameras.Active = true |
385 | + | |
386 | _G.active_Objects.Cameras.Active = true | |
387 | end | |
388 | end | |
389 | end | |
390 | ||
391 | - | if active_Objects.Freecam.Active == true then |
391 | + | local function last_cam() |
392 | if _G.active_Objects.Freecam.Active == true then | |
393 | for _,p1 in pairs(looped_Commands) do | |
394 | if p1.Type == "Freecam" then | |
395 | p1.Target:Destroy(); | |
396 | table.remove(looped_Commands,_); | |
397 | end; | |
398 | end; | |
399 | Player.Character.HumanoidRootPart.Anchored = false; | |
400 | - | active_Objects.Freecam.Active = false |
400 | + | _G.active_Objects.Freecam.Active = false |
401 | end | |
402 | - | if active_Objects.Cameras.CameraPosition + 1 > active_Objects.Cameras.ActiveCamera then |
402 | + | if _G.active_Objects.Cameras.CameraPosition - 1 == 0 then |
403 | - | active_Objects.Cameras.CameraPosition = 1 |
403 | + | _G.active_Objects.Cameras.CameraPosition = _G.active_Objects.Cameras.ActiveCamera |
404 | else | |
405 | - | active_Objects.Cameras.CameraPosition = active_Objects.Cameras.CameraPosition + 1 |
405 | + | _G.active_Objects.Cameras.CameraPosition = _G.active_Objects.Cameras.CameraPosition - 1 |
406 | end | |
407 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
407 | + | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do |
408 | - | if _ == active_Objects.Cameras.CameraPosition then |
408 | + | if _ == _G.active_Objects.Cameras.CameraPosition then |
409 | workspace.CurrentCamera.CameraSubject = p1.Target | |
410 | - | active_Objects.Cameras.Active = true |
410 | + | _G.active_Objects.Viewing = p1.Target |
411 | if _G.active_Objects.Cameras.Active == false then | |
412 | for _,v in pairs(_G.active_Objects.Cameras.viewBegan.Connected_Functions) do | |
413 | v.Func(p1.Target,p1.Extra) | |
414 | end | |
415 | end | |
416 | - | if active_Objects.Freecam.Active == true then |
416 | + | for _,v in pairs(_G.active_Objects.Cameras.PositionChanged.Connected_Functions) do |
417 | v.Func(p1.Target,p1.Extra) | |
418 | end | |
419 | _G.active_Objects.Cameras.Active = true | |
420 | return true, "Viewing camera " .. _ | |
421 | end | |
422 | end | |
423 | end | |
424 | - | active_Objects.Freecam.Active = false |
424 | + | |
425 | RightButton.MouseButton1Down:Connect(function() | |
426 | - | if active_Objects.Cameras.CameraPosition - 1 == 0 then |
426 | + | next_cam() |
427 | - | active_Objects.Cameras.CameraPosition = active_Objects.Cameras.ActiveCamera |
427 | + | |
428 | LeftButton.MouseButton1Down:Connect(function() | |
429 | - | active_Objects.Cameras.CameraPosition = active_Objects.Cameras.CameraPosition - 1 |
429 | + | last_cam() |
430 | end) | |
431 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
431 | + | |
432 | - | if _ == active_Objects.Cameras.CameraPosition then |
432 | + | |
433 | local p1 = Instance.new("Part",_G.waypoint_Folder); | |
434 | - | active_Objects.Cameras.Active = true |
434 | + | |
435 | local p3 = Instance.new("Frame",p2); | |
436 | local p4 = Instance.new("TextLabel", p3) | |
437 | p1.Name = math.random(1,100); | |
438 | p2.Name = math.random(1,100); | |
439 | p3.Name = math.random(1,100); | |
440 | p4.Name = math.random(1,100); | |
441 | - | active_Objects.Cameras.Active = false |
441 | + | |
442 | - | return true, "Unviewd camera " .. active_Objects.Cameras.CameraPosition |
442 | + | |
443 | p1.CanCollide = false; | |
444 | p2.AlwaysOnTop = true; | |
445 | - | if active_Objects.Cameras.Active == true then |
445 | + | |
446 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
446 | + | |
447 | - | if _ == active_Objects.Cameras.CameraPosition then |
447 | + | |
448 | p3.Transparency = 0.5; | |
449 | p3.BorderSizePixel = 0; | |
450 | p3.Visible = true; | |
451 | p4.Position = UDim2.new(0,7.5,0,-9.9) | |
452 | - | elseif active_Objects.Freecam.Active == true then |
452 | + | |
453 | - | Player.Character.HumanoidRootPart.CFrame = activeObjects:FindFirstChild("Freecam").CFrame |
453 | + | |
454 | p4.TextXAlignment = Enum.TextXAlignment.Center | |
455 | p4.BackgroundTransparency = 1 | |
456 | local p69 = false | |
457 | if text ~= nil then | |
458 | - | for _,p1 in pairs(active_Objects.Cameras.ActiveCameras) do |
458 | + | p69 = true |
459 | - | if _ == active_Objects.Cameras.CameraPosition then |
459 | + | |
460 | else | |
461 | - | for a,p2 in pairs(active_Objects.Cameras.CameraPoints) do |
461 | + | |
462 | - | if a == active_Objects.Cameras.CameraPosition then |
462 | + | |
463 | if _G.active_Objects.Freecam.Active == true then | |
464 | - | table.remove(active_Objects.Cameras.CameraPoints,a) |
464 | + | p1.CFrame = _G.active_Objects:FindFirstChild("Freecam").CFrame |
465 | else | |
466 | p1.CFrame = Player.Character.HumanoidRootPart.CFrame; | |
467 | - | table.remove(active_Objects.Cameras.ActiveCameras,_) |
467 | + | |
468 | - | active_Objects.Cameras.ActiveCamera = active_Objects.Cameras.ActiveCamera - 1 |
468 | + | table.insert(_G.active_Objects.Waypoints.ActiveWaypoints, {Type="Waypoint",Subject=p1,Extra=p4,Check=p69}) |
469 | - | if active_Objects.Cameras.CameraPosition + 1 > active_Objects.Cameras.ActiveCamera then |
469 | + | for _,v in pairs(_G.active_Objects.Waypoints.Created.Connected_Functions) do |
470 | - | active_Objects.Cameras.CameraPosition = 1 |
470 | + | v.Func(p1,p4.Text) |
471 | end | |
472 | - | active_Objects.Cameras.CameraPosition = active_Objects.Cameras.CameraPosition + 1 |
472 | + | _G.active_Objects.Waypoints.ActiveWaypoint = _G.active_Objects.Waypoints.ActiveWaypoint + 1 |
473 | end; | |
474 | - | for _,p2 in pairs(active_Objects.Cameras.ActiveCameras) do |
474 | + | |
475 | - | if _ == active_Objects.Cameras.CameraPosition then |
475 | + | local function createCamera(data) |
476 | local p1 = Instance.new('Part',_G.camera_Folder) | |
477 | - | active_Objects.Cameras.Active = true |
477 | + | |
478 | p1.CanCollide = false | |
479 | p1.Anchored = true | |
480 | p1.Transparency = 1 | |
481 | - | for _,p2 in pairs(active_Objects.Cameras.CameraPoints) do |
481 | + | |
482 | - | p2.Extra.Text = "Camera" .. _ |
482 | + | local p5 = Instance.new("Part",_G.camera_Folder); |
483 | local p2 = Instance.new("BillboardGui", p5); | |
484 | local p3 = Instance.new("Frame",p2); | |
485 | local p4 = Instance.new("TextLabel", p3) | |
486 | p5.Name = math.random(1,100); | |
487 | p2.Name = math.random(1,100); | |
488 | p3.Name = math.random(1,100); | |
489 | p4.Name = math.random(1,100); | |
490 | - | for _,p1 in pairs(camera_Folder:GetDescendants()) do |
490 | + | |
491 | p5.Transparency = 1; | |
492 | p5.CanCollide = false; | |
493 | p2.AlwaysOnTop = true; | |
494 | p2.Size = UDim2.new(0,25,0,25); | |
495 | p3.BackgroundColor3 = Color3.fromRGB(math.random(1,255),math.random(1,255),math.random(1,255)); | |
496 | p3.Size = UDim2.new(0,25,0,25); | |
497 | - | for _,p1 in pairs(camera_Folder:GetDescendants()) do |
497 | + | |
498 | p3.BorderSizePixel = 0; | |
499 | p3.Visible = true; | |
500 | p4.Position = UDim2.new(0,7.5,0,-9.9) | |
501 | p4.TextColor3 = p3.BackgroundColor3 | |
502 | p4.Size = UDim2.new(0,10,0,10) | |
503 | p4.TextXAlignment = Enum.TextXAlignment.Center | |
504 | p4.BackgroundTransparency = 1 | |
505 | - | [prefix .. 'save '] = function() |
505 | + | |
506 | - | save() |
506 | + | table.insert(_G.active_Objects.Cameras.CameraPoints,{Type="Waypoint",Target=p5,Extra=p4}) |
507 | - | return true, "Saved data" |
507 | + | _G.active_Objects.Cameras.ActiveCamera = _G.active_Objects.Cameras.ActiveCamera + 1 |
508 | - | end, |
508 | + | if data == nil then |
509 | p4.Text = "Camera" .. _G.active_Objects.Cameras.ActiveCamera | |
510 | else | |
511 | p4.Text = data | |
512 | end | |
513 | table.insert(_G.active_Objects.Cameras.ActiveCameras, {Type="Camera",Target=p1,Extra=p4.Text}) | |
514 | for _,v in pairs(_G.active_Objects.Waypoints.Created.Connected_Functions) do | |
515 | v.Func(p5,p4.Text) | |
516 | end | |
517 | for _,v in pairs(_G.active_Objects.Cameras.Created.Connected_Functions) do | |
518 | v.Func(p1,p4.Text) | |
519 | end | |
520 | return true | |
521 | end | |
522 | ||
523 | -- Save/Load | |
524 | pcall(function() | |
525 | if isfolder("FXAdmin") then | |
526 | if isfile("FXAdmin/" .. GameName .. ".lua") then | |
527 | data = loadfile("FXAdmin/" .. GameName .. ".lua") | |
528 | local succes,failure = pcall(function() | |
529 | data() | |
530 | ||
531 | end) | |
532 | if not succes then print(failure) else Already_Loaded = true end | |
533 | end | |
534 | else | |
535 | makefolder("FXAdmin") | |
536 | end | |
537 | end) | |
538 | ||
539 | ||
540 | local function sti(data,parent) return " Instance.new('"..data.ClassName.."',"..parent..")\n" end -- Instance to string | |
541 | - | if p3 ~= nil then |
541 | + | |
542 | - | p4, p5 = Commands[p2:lower()](p3) |
542 | + | |
543 | local a,b = pcall(function() | |
544 | local data = "\n-- FXAdmin save for "..GameName .. ".\n\nif game.GameId == " .. game.GameId .. " then\n" | |
545 | - | p4, p5 = Commands[p2:lower()]() |
545 | + | |
546 | for _,p1 in pairs(_G.active_Objects.Waypoints.ActiveWaypoints) do | |
547 | - | if p4 == true then |
547 | + | data = data .. " local w".. _ .." = Instance.new('" .. p1.Subject.ClassName .. "',_G.waypoint_Folder)\n" |
548 | - | print("FXHub: " .. p5); |
548 | + | data = data .. " table.insert(_G.active_Objects.Waypoints.ActiveWaypoints, {Type='Waypoint',Subject= w" .. _ .. "})\n" |
549 | - | elseif p4 == nil then |
549 | + | data = data .. " w" .. _ .. ".CFrame = CFrame.new(" .. tostring(p1.Subject.CFrame) .. ")\n" |
550 | - | error("FXHub: Command not found " .. p2); |
550 | + | data = data .. " w" .. _ .. ".Transparency = 1\n" |
551 | data = data .. " w" .. _ .. ".Anchored = true\n" | |
552 | data = data .. " w" .. _ .. ".CanCollide = false\n" | |
553 | data = data .. " w" .. _ .. ".Name = math.random(1,100)\n" | |
554 | for x,z in pairs(p1.Subject:GetDescendants()) do | |
555 | local p2 | |
556 | if x == 1 then | |
557 | p2 = "" | |
558 | else | |
559 | p2 = "_" .. 1*(x-1) | |
560 | end | |
561 | data = data .. " local w".. _ .."_" .. x .. " = Instance.new('" .. z.ClassName .. "',w".. _ .. p2 ..")\n" | |
562 | data = data .. " w" .. _ .. "_" .. x .. ".Name = math.random(1,100)\n" | |
563 | if z:IsA("Frame") then | |
564 | data = data .. " w" .. _ .. "_" .. x .. ".BorderSizePixel = 0\n" | |
565 | data = data .. " w" .. _ .. "_" .. x .. ".Transparency = 0.5\n" | |
566 | data = data .. " w" .. _ .. "_" .. x .. ".Size = UDim2.new(0,25,0,25)\n" | |
567 | - | for _,p1 in pairs(looped_Commands) do |
567 | + | data = data .. " w" .. _ .. "_" .. x .. ".BackgroundColor3 = Color3.fromRGB(0,0,0)\n" |
568 | - | loop_Command[p1.Type](p1.Target,_,dt) |
568 | + | elseif z:IsA("TextLabel") then |
569 | data = data .. " w" .. _ .. "_" .. x .. ".Size = UDim2.new(0,10,0,10)\n" | |
570 | data = data .. " w" .. _ .. "_" .. x .. ".Position = UDim2.new(0,7.5,0,-9.9)\n" | |
571 | data = data .. " w" .. _ .. "_" .. x .. ".TextXAlignment = Enum.TextXAlignment.Center\n" | |
572 | data = data .. " w" .. _ .. "_" .. x .. ".BackgroundTransparency = 1\n" | |
573 | data = data .. " w" .. _ .. "_" .. x .. ".TextColor3 = Color3.fromRGB(0,0,0)\n" | |
574 | data = data .. " w" .. _ .. "_" .. x .. ".Text = '" .. z.Text .. "'\n" | |
575 | elseif z:IsA("BillboardGui") then | |
576 | data = data .. " w" .. _ .. "_" .. x .. ".AlwaysOnTop = true\n" | |
577 | data = data .. " w" .. _ .. "_" .. x .. ".Size = UDim2.new(0,25,0,25)\n" | |
578 | end | |
579 | end | |
580 | end | |
581 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
582 | data = data .. " local c".. _ .." = Instance.new('" .. p1.Target.ClassName .. "',_G.camera_Folder)\n" | |
583 | data = data .. " table.insert(_G.active_Objects.Cameras.ActiveCameras, {Type='Camera',Target=c" .. _ .. ",Extra='".. p1.Extra .."'})\n" | |
584 | data = data .. " c" .. _ .. ".CFrame = CFrame.new(" .. tostring(p1.Target.CFrame) .. ")\n" | |
585 | data = data .. " c" .. _ .. ".Transparency = 1\n" | |
586 | data = data .. " c" .. _ .. ".Anchored = true\n" | |
587 | data = data .. " c" .. _ .. ".CanCollide = false\n" | |
588 | data = data .. " c" .. _ .. ".Name = math.random(1,100)\n" | |
589 | end | |
590 | for _,p1 in pairs(_G.active_Objects.Cameras.CameraPoints) do | |
591 | local p2 = false | |
592 | for a,x in pairs(p1.Target:GetDescendants()) do | |
593 | if x:IsA("Frame") then | |
594 | p2 = true | |
595 | end | |
596 | end | |
597 | if p2 == true then | |
598 | data = data .. " local cw".. _ .." = Instance.new('" .. p1.Target.ClassName .. "',_G.camera_Folder)\n" | |
599 | data = data .. " table.insert(_G.active_Objects.Waypoints.ActiveWaypoints, {Type='Waypoint',Subject= cw" .. _ .. "})\n" | |
600 | data = data .. " cw" .. _ .. ".CFrame = CFrame.new(" .. tostring(p1.Target.CFrame) .. ")\n" | |
601 | data = data .. " cw" .. _ .. ".Transparency = 1\n" | |
602 | data = data .. " cw" .. _ .. ".Anchored = true\n" | |
603 | data = data .. " cw" .. _ .. ".CanCollide = false\n" | |
604 | data = data .. " cw" .. _ .. ".Name = math.random(1,100)\n" | |
605 | for x,z in pairs(p1.Target:GetDescendants()) do | |
606 | local p2 | |
607 | if x == 1 then | |
608 | p2 = "" | |
609 | else | |
610 | p2 = "_" .. 1*(x-1) | |
611 | end | |
612 | data = data .. " local cw".. _ .."_" .. x .. " = Instance.new('" .. z.className .. "',cw".. _ .. p2 ..")\n" | |
613 | data = data .. " cw" .. _ .. "_" .. x .. ".Name = math.random(1,100)\n" | |
614 | if z:IsA("Frame") then | |
615 | data = data .. " cw" .. _ .. "_" .. x .. ".BorderSizePixel = 0\n" | |
616 | data = data .. " cw" .. _ .. "_" .. x .. ".Transparency = 0.5\n" | |
617 | data = data .. " cw" .. _ .. "_" .. x .. ".Size = UDim2.new(0,25,0,25)\n" | |
618 | data = data .. " cw" .. _ .. "_" .. x .. ".BackgroundColor3 = Color3.fromRGB(0,0,0)\n" | |
619 | elseif z:IsA("TextLabel") then | |
620 | data = data .. " cw" .. _ .. "_" .. x .. ".Size = UDim2.new(0,10,0,10)\n" | |
621 | data = data .. " cw" .. _ .. "_" .. x .. ".Position = UDim2.new(0,7.5,0,-9.9)\n" | |
622 | data = data .. " cw" .. _ .. "_" .. x .. ".TextXAlignment = Enum.TextXAlignment.Center\n" | |
623 | data = data .. " cw" .. _ .. "_" .. x .. ".BackgroundTransparency = 1\n" | |
624 | data = data .. " cw" .. _ .. "_" .. x .. ".TextColor3 = Color3.fromRGB(0,0,0)\n" | |
625 | data = data .. " cw" .. _ .. "_" .. x .. ".Text = '" .. z.Text .. "'\n" | |
626 | elseif z:IsA("BillboardGui") then | |
627 | data = data .. " cw" .. _ .. "_" .. x .. ".Size = UDim2.new(0,25,0,25)\n" | |
628 | data = data .. " cw" .. _ .. "_" .. x .. ".AlwaysOnTop = true\n" | |
629 | end | |
630 | end | |
631 | end | |
632 | end | |
633 | data = data .. " _G.active_Objects.Cameras.ActiveCamera = _G.active_Objects.Cameras.ActiveCamera + " .. #_G.active_Objects.Cameras.ActiveCameras .. "\n" | |
634 | data = data .. "end" | |
635 | print (data) | |
636 | print('Completed Save') | |
637 | writefile("FXAdmin/" .. GameName .. ".lua", data) | |
638 | end) | |
639 | if not a then print(b) end | |
640 | end | |
641 | ||
642 | -- Dictionarys | |
643 | local Commands = { | |
644 | [prefix .. 'tp '] = function(data) | |
645 | local p1,p2 = getPlayer(data) | |
646 | if p1 == true then | |
647 | Player.Character.HumanoidRootPart.CFrame = p2.Character.HumanoidRootPart.CFrame; | |
648 | return true, "Teleported to " .. p2.Name; | |
649 | end; | |
650 | end, | |
651 | [prefix .. 'follow '] = function(data) | |
652 | local p1,p2 = getPlayer(data) | |
653 | if p1 == true then | |
654 | for _,p3 in pairs(looped_Commands) do | |
655 | if p3.Type == "Follow" then | |
656 | table.remove(looped_Commands,_); | |
657 | end; | |
658 | end; | |
659 | table.insert(looped_Commands, {Type="Follow",Target=p2}) | |
660 | Player.Character.HumanoidRootPart.CFrame = p2.Character.HumanoidRootPart.CFrame + (p2.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(-2.5,0,-2.5)); | |
661 | return true, "Followed " .. p2.Name; | |
662 | end | |
663 | end, | |
664 | [prefix .. 'unfollow '] = function(data) | |
665 | local p1 = false | |
666 | for _,p2 in pairs(looped_Commands) do | |
667 | if p2.Type == "Follow" then | |
668 | table.remove(looped_Commands, _); | |
669 | p1 = p2.Target.Name | |
670 | end; | |
671 | end; | |
672 | if p1 ~= false then | |
673 | return true, "Unfollowed " .. p1; | |
674 | else | |
675 | return true, "Not following anyone" | |
676 | end | |
677 | end, | |
678 | [prefix .. 'view '] = function(data) | |
679 | local p1,p2 = getPlayer(data) | |
680 | if p1 == true then | |
681 | workspace.CurrentCamera.CameraSubject = p2.Character:FindFirstChildOfClass("Humanoid") or p2.Character.HumanoidRootPart or p2.Character:FindFirstChildOfClass("BasePart"); | |
682 | _G.active_Objects.Viewing = p2.Character:FindFirstChildOfClass("Humanoid") | |
683 | view_Name = p2.Name | |
684 | return true, "Viewed " .. p2.Name; | |
685 | end; | |
686 | end, | |
687 | [prefix .. 'unview '] = function(data) | |
688 | AO.Cameras.Watching = false | |
689 | Player.CameraMode = Enum.CameraMode.Classic | |
690 | UIS.MouseIconEnabled = true | |
691 | pcall(function() | |
692 | for _,v in pairs(CamerasNotObstructed) do | |
693 | table.remove(CamerasNotObstructed,_) | |
694 | end | |
695 | for _,v in pairs(looped_Commands) do | |
696 | if v.Type == "CameraLookAt" then | |
697 | table.remove(looped_Commands,_) | |
698 | UIS.MouseIconEnabled = true | |
699 | end | |
700 | end | |
701 | end) | |
702 | _G.active_Objects.Viewing = Player.Character:FindFirstChildOfClass("Humanoid") | |
703 | if _G.active_Objects.Freecam.Active == true then | |
704 | for _,p1 in pairs(looped_Commands) do | |
705 | if p1.Type == "Freecam" then | |
706 | p1.Target:Destroy(); | |
707 | table.remove(looped_Commands,_); | |
708 | end; | |
709 | end; | |
710 | for _,v in pairs(_G.activ_eObjects.Freecam.Disabled.Connected_Functions) do | |
711 | v.Func() | |
712 | end | |
713 | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") | |
714 | Player.Character.HumanoidRootPart.Anchored = false; | |
715 | _G.active_Objects.Freecam.Active = false | |
716 | end | |
717 | if _G.active_Objects.Cameras.Active == true then | |
718 | workspace.CurrentCamera.CameraSubject = Player.Character.Humanoid | |
719 | if _G.active_Objects.Cameras.Active == true then | |
720 | for _,v in pairs(_G.active_Objects.Cameras.viewEnded.Connected_Functions) do | |
721 | v.Func() | |
722 | end | |
723 | end | |
724 | _G.active_Objects.Cameras.Active = false | |
725 | end | |
726 | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") | |
727 | ||
728 | return true, "Unviewed " .. view_Name; | |
729 | end, | |
730 | [prefix .. 'annoy '] = function(data) | |
731 | local p1,p2 = getPlayer(data) | |
732 | if p1 == true then | |
733 | for _,p3 in pairs(looped_Commands) do | |
734 | if p3.Type == "Annoy" then | |
735 | table.remove(looped_Commands,_) | |
736 | end | |
737 | end | |
738 | table.insert(looped_Commands, {Type="Annoy",Target=p2}); | |
739 | Player.Character.HumanoidRootPart.CFrame = p2.Character.HumanoidRootPart.CFrame; | |
740 | return true, "Annoyed " .. p2.Name; | |
741 | end; | |
742 | end, | |
743 | [prefix .. 'unannoy '] = function(data) | |
744 | local p2 = false | |
745 | for _,p1 in pairs(looped_Commands) do | |
746 | if p1.Type == "Annoy" then | |
747 | table.remove(looped_Commands,_); | |
748 | p2 = p1.Target.Name | |
749 | end; | |
750 | end; | |
751 | if p2 ~= false then | |
752 | return true, "Unannoyed " .. p2; | |
753 | else | |
754 | return true, "Not annoying anyone" | |
755 | end | |
756 | end, | |
757 | [prefix.. 'waypoint '] = function(data) | |
758 | createWaypoint(data) | |
759 | return true, "Created waypoint"; | |
760 | end, | |
761 | [prefix .. 'waypoints '] = function(data) | |
762 | if data:lower() == "on" then | |
763 | for _,p1 in pairs(_G.waypoint_Folder:GetDescendants()) do | |
764 | if p1:IsA("Frame") then | |
765 | p1.Visible = true; | |
766 | end; | |
767 | end; | |
768 | return true, "Toggled waypoints on"; | |
769 | elseif data:lower() == "off" then | |
770 | for _,p1 in pairs(_G.waypoint_Folder:GetDescendants()) do | |
771 | if p1:IsA("Frame") then | |
772 | p1.Visible = false; | |
773 | end; | |
774 | end; | |
775 | return true, "Toggled waypoints off"; | |
776 | elseif data:lower() == "destroy" then | |
777 | _G.active_Objects.Waypoints.ActiveWaypoints = 0 | |
778 | for _,p1 in pairs(_G.waypoint_Folder:GetChildren()) do | |
779 | p1:Destroy(); | |
780 | end; | |
781 | for _,p1 in pairs(_G.active_Objects.Waypoints.ActiveWaypoints) do | |
782 | table.remove(_G.active_Objects.Waypoints.ActiveWaypoints,_) | |
783 | end | |
784 | for _,v in pairs(_G.active_Objects.Waypoints.Destroyed.Connected_Functions) do | |
785 | v.Func() | |
786 | end | |
787 | return true, "Destroyed waypoints"; | |
788 | end; | |
789 | end, | |
790 | [prefix .. 'freecam '] = function(data) | |
791 | if data:lower() == "on" then | |
792 | _G.active_Objects.Freecam.Active = true | |
793 | if _G.active_Objects.Cameras.Active == true then | |
794 | workspace.CurrentCamera.CameraSubject = Player.Character.Humanoid | |
795 | if _G.active_Objects.Cameras.Active == true then | |
796 | for _,v in pairs(_G.active_Objects.Cameras.viewEnded.Connected_Functions) do | |
797 | v.Func() | |
798 | end | |
799 | end | |
800 | _G.active_Objects.Cameras.Active = false | |
801 | end | |
802 | local p1 = Instance.new("Part",workspace); | |
803 | p1.Name = "Freecam"; | |
804 | p1.CanCollide = false; | |
805 | p1.Transparency = 1; | |
806 | p1.Anchored = true; | |
807 | p1.Parent = _G.activeObjects | |
808 | p1.CFrame = workspace.CurrentCamera.CFrame; | |
809 | workspace.CurrentCamera.CameraSubject = p1; | |
810 | _G.active_Objects.Viewing = p1; | |
811 | table.insert(looped_Commands, {Type="Freecam", Target=p1}); | |
812 | Player.Character.HumanoidRootPart.Anchored = true; | |
813 | for _,v in pairs(_G.active_Objects.Freecam.Activated.Connected_Functions) do | |
814 | v.Func(p1) | |
815 | end | |
816 | return true, "Freecam enabled"; | |
817 | elseif data:lower() == "off" then | |
818 | for _,p1 in pairs(looped_Commands) do | |
819 | if p1.Type == "Freecam" then | |
820 | p1.Target:Destroy(); | |
821 | table.remove(looped_Commands,_); | |
822 | end; | |
823 | end; | |
824 | for _,v in pairs(_G.active_Objects.Freecam.Disabled.Connected_Functions) do | |
825 | v.Func() | |
826 | end | |
827 | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") | |
828 | _G.active_Objects.Viewing = Player.Character:FindFirstChildOfClass("Humanoid") | |
829 | Player.Character.HumanoidRootPart.Anchored = false; | |
830 | _G.active_Objects.Freecam.Active = false | |
831 | return true, "Freecam disabled"; | |
832 | end; | |
833 | end, | |
834 | [prefix .. 'createcam '] = function(data) | |
835 | local p1 = createCamera(data) | |
836 | return true, "Camera created" | |
837 | end, | |
838 | [prefix .. 'viewcam '] = function() | |
839 | if _G.active_Objects.Freecam.Active == true then | |
840 | for _,p1 in pairs(looped_Commands) do | |
841 | if p1.Type == "Freecam" then | |
842 | p1.Target:Destroy(); | |
843 | table.remove(looped_Commands,_); | |
844 | end; | |
845 | end; | |
846 | for _,v in pairs(_G.activ_eObjects.Freecam.Disabled.Connected_Functions) do | |
847 | v.Func() | |
848 | end | |
849 | workspace.CurrentCamera.CameraSubject = Player.Character:FindFirstChildOfClass("Humanoid") | |
850 | Player.Character.HumanoidRootPart.Anchored = false; | |
851 | _G.active_Objects.Freecam.Active = false | |
852 | end | |
853 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
854 | if _ == _G.active_Objects.Cameras.CameraPosition then | |
855 | workspace.CurrentCamera.CameraSubject = p1.Target | |
856 | if _G.active_Objects.Cameras.Active == false then | |
857 | for _,v in pairs(_G.active_Objects.Cameras.viewBegan.Connected_Functions) do | |
858 | v.Func(p1.Target,p1.Extra) | |
859 | end | |
860 | end | |
861 | _G.active_Objects.Cameras.Active = true | |
862 | _G.active_Objects.Viewing = p1.Target | |
863 | return true, "Viewing camera " .. _ | |
864 | elseif _G.active_Objects.Cameras.CameraPosition == 0 then | |
865 | workspace.CurrentCamera.CameraSubject = p1.Target | |
866 | _G.active_Objects.Viewing = p1.Target | |
867 | _G.active_Objects.Cameras.CameraPosition = _G.active_Objects.Cameras.CameraPosition + 1 | |
868 | for _,v in pairs(_G.active_Objects.Cameras.PositionChanged.Connected_Functions) do | |
869 | v.Func(p1.Target,p1.Extra) | |
870 | end | |
871 | _G.active_Objects.Cameras.Active = true | |
872 | return true, "Viewing camera " .. _ | |
873 | end | |
874 | end | |
875 | end, | |
876 | [prefix .. 'next '] = function() | |
877 | next_cam() | |
878 | return true, "Viewing next Camera" | |
879 | end, | |
880 | [prefix .. 'last '] = function() | |
881 | last_cam() | |
882 | return true, "Viewing last Camera" | |
883 | end, | |
884 | [prefix .. 'unviewcameras '] = function() | |
885 | AO.Cameras.Watching = false | |
886 | for _,v in pairs(CamerasNotObstructed) do | |
887 | table.remove(CamerasNotObstructed,_) | |
888 | end | |
889 | for _,v in pairs(looped_Commands) do | |
890 | if v.Type == "CameraLookAt" then | |
891 | table.remove(looped_Commands,_) | |
892 | UIS.MouseIconEnabled = true | |
893 | end | |
894 | end | |
895 | ||
896 | Player.CameraMode = Enum.CameraMode.Classic | |
897 | UIS.MouseIconEnabled = false | |
898 | workspace.CurrentCamera.CameraSubject = Player.Character.Humanoid | |
899 | _G.active_Objects.Viewing = Player.Character.Humanoid | |
900 | if _G.active_Objects.Cameras.Active == true then | |
901 | for _,v in pairs(_G.active_Objects.Cameras.viewEnded.Connected_Functions) do | |
902 | v.Func() | |
903 | end | |
904 | end | |
905 | _G.active_Objects.Cameras.Active = false | |
906 | ||
907 | return true, "Unviewd camera " .. _G.active_Objects.Cameras.CameraPosition | |
908 | end, | |
909 | [prefix .. "tptocam "] = function() | |
910 | if _G.active_Objects.Cameras.Active == true then | |
911 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
912 | if _ == _G.active_Objects.Cameras.CameraPosition then | |
913 | Player.Character.HumanoidRootPart.CFrame = p1.Target.CFrame | |
914 | return true, 'Teleported to camera ' .. _ | |
915 | end | |
916 | end | |
917 | elseif _G.active_Objects.Freecam.Active == true then | |
918 | Player.Character.HumanoidRootPart.CFrame = _G.activeObjects:FindFirstChild("Freecam").CFrame | |
919 | return true, "Teleported to freecam camera" | |
920 | end | |
921 | end, | |
922 | [prefix .. "destroycam "] = function() | |
923 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
924 | if _ == _G.active_Objects.Cameras.CameraPosition then | |
925 | p1.Target:Destroy() | |
926 | for a,p2 in pairs(_G.active_Objects.Cameras.CameraPoints) do | |
927 | if a == _G.active_Objects.Cameras.CameraPosition then | |
928 | p2.Target:Destroy() | |
929 | table.remove(_G.active_Objects.Cameras.CameraPoints,a) | |
930 | end | |
931 | end | |
932 | table.remove(_G.active_Objects.Cameras.ActiveCameras,_) | |
933 | _G.active_Objects.Cameras.ActiveCamera = _G.active_Objects.Cameras.ActiveCamera - 1 | |
934 | if _G.active_Objects.Cameras.CameraPosition + 1 > _G.active_Objects.Cameras.ActiveCamera then | |
935 | _G.active_Objects.Cameras.CameraPosition = 1 | |
936 | else | |
937 | _G.active_Objects.Cameras.CameraPosition = _G.active_Objects.Cameras.CameraPosition + 1 | |
938 | end | |
939 | for _,p2 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
940 | if _ == _G.active_Objects.Cameras.CameraPosition then | |
941 | workspace.CurrentCamera.CameraSubject = p2.Target | |
942 | _G.active_Objects.Viewing = p2.Target | |
943 | _G.active_Objects.Cameras.Active = true | |
944 | end | |
945 | end | |
946 | ||
947 | for _,p2 in pairs(_G.active_Objects.Cameras.CameraPoints) do | |
948 | if p2.Check == false then | |
949 | p2.Extra.Text = "Camera" .. _ | |
950 | end | |
951 | end | |
952 | return true, 'Destroyed camera ' .. _ | |
953 | end | |
954 | end | |
955 | end, | |
956 | [prefix .. 'camwaypoints '] = function(data) | |
957 | if data:lower() == "on" then | |
958 | for _,p1 in pairs(_G.camera_Folder:GetDescendants()) do | |
959 | if p1:IsA("Frame") then | |
960 | p1.Visible = true; | |
961 | end; | |
962 | end; | |
963 | return true, "Toggled camera waypoints on" | |
964 | elseif data:lower() == "off" then | |
965 | for _,p1 in pairs(_G.camera_Folder:GetDescendants()) do | |
966 | if p1:IsA("Frame") then | |
967 | p1.Visible = false; | |
968 | end; | |
969 | end; | |
970 | return true, "Toggled camera waypoints off" | |
971 | end | |
972 | end, | |
973 | [prefix .. 'save '] = function() | |
974 | save() | |
975 | return true, "Saved data" | |
976 | end, | |
977 | [prefix .. 'load '] = function() | |
978 | if Already_Loaded == true then | |
979 | sendNotif("Already Loaded.") | |
980 | else | |
981 | if isfolder("FXAdmin") then | |
982 | if isfile("FXAdmin/" .. GameName .. ".lua") then | |
983 | data = loadfile("FXAdmin/" .. GameName .. ".lua") | |
984 | local succes,failure = pcall(function() | |
985 | data() | |
986 | end) | |
987 | if not succes then print(failure) else Already_Loaded = true end | |
988 | end | |
989 | else | |
990 | makefolder("FXAdmin") | |
991 | end | |
992 | end | |
993 | end, | |
994 | [prefix .. 'camview '] = function(data) | |
995 | local p1, p2 = getPlayer(data) | |
996 | if p1 == true then | |
997 | local p3 = p2.Character.HumanoidRootPart | |
998 | local p6 = p3.Position | |
999 | for _,p4 in pairs(AO.Cameras.ActiveCameras) do | |
1000 | p4.Target.CFrame = CFrame.lookAt(p4.Target.Position,Vector3.new(p6.X,p6.Y,p6.Z)) | |
1001 | Player.CameraMode = Enum.CameraMode.LockFirstPerson | |
1002 | end | |
1003 | AO.Cameras.Active = true | |
1004 | AO.Cameras.Watching = true | |
1005 | table.insert(looped_Commands,{Type="CameraLookAt",Target=p3}) | |
1006 | return true, "Looked at " .. p2.Name | |
1007 | end | |
1008 | end, | |
1009 | [prefix .. 'rtp '] = function(data) | |
1010 | local p1,p2 = getPlayer(data) | |
1011 | if p1 == true then | |
1012 | Player.Character.Humanoid.Health = -Player.Character.Humanoid.Health | |
1013 | RTP_TO = p2.Character.HumanoidRootPart.CFrame | |
1014 | return true, "Reset teleported to " .. p2.Name; | |
1015 | end | |
1016 | end, | |
1017 | } | |
1018 | local CamerasNotObstructed = {} | |
1019 | local loop_Command = { | |
1020 | ['Follow'] = function(p1,p2,p3) | |
1021 | Player.Character.HumanoidRootPart.CFrame = p1.Character.HumanoidRootPart.CFrame + (p1.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(-2.5,0,-2.5)); | |
1022 | end, | |
1023 | ['Annoy'] = function(p1,p2,p3) | |
1024 | Player.Character.HumanoidRootPart.CFrame = p1.Character.HumanoidRootPart.CFrame; | |
1025 | end, | |
1026 | ['Freecam'] = function(p1,p2,dt) | |
1027 | if tb == false then | |
1028 | if UIS:IsKeyDown(Enum.KeyCode.W) then | |
1029 | p1.CFrame = p1.CFrame + workspace.CurrentCamera.CFrame.lookVector * Vector3.new(fcs*dt,1,fcs*dt) | |
1030 | end | |
1031 | if UIS:IsKeyDown(Enum.KeyCode.S) then | |
1032 | p1.CFrame = p1.CFrame + workspace.CurrentCamera.CFrame.lookVector * Vector3.new(-(fcs*dt),-1,-(fcs*dt)) | |
1033 | end | |
1034 | if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then | |
1035 | p1.CFrame = p1.CFrame - Vector3.new(0,fcs*dt,0) | |
1036 | end | |
1037 | if UIS:IsKeyDown(Enum.KeyCode.Space) then | |
1038 | p1.CFrame = p1.CFrame + Vector3.new(0,fcs*dt,0) | |
1039 | end | |
1040 | end | |
1041 | end, | |
1042 | ['CameraLookAt'] = function(p6) | |
1043 | local obj = p6.Position | |
1044 | UIS.MouseIconEnabled = false | |
1045 | Holder.Visible = false | |
1046 | if AO.Cameras.Active == true and AO.Cameras.Watching == true then | |
1047 | for __Index,v in pairs(AO.Cameras.ActiveCameras) do | |
1048 | local fromCameraToPart = obj - v.Target.CFrame.Position | |
1049 | local p5 = Ray.new(v.Target.CFrame.Position, fromCameraToPart) | |
1050 | local hit, position = workspace:FindPartOnRay(p5, p6) | |
1051 | if Players:GetPlayerFromCharacter(hit:FindFirstAncestorWhichIsA("Model")) then | |
1052 | local temp_A = false | |
1053 | for _,a in pairs(CamerasNotObstructed) do | |
1054 | if a.Target == v.Target then | |
1055 | temp_A = true | |
1056 | end | |
1057 | end | |
1058 | if temp_A == false then | |
1059 | table.insert(CamerasNotObstructed,{Target=v.Target,Index=__Index}) | |
1060 | end | |
1061 | else | |
1062 | for _,a in pairs(CamerasNotObstructed) do | |
1063 | if a.Target == v.Target then | |
1064 | table.remove(CamerasNotObstructed,_) | |
1065 | end | |
1066 | end | |
1067 | end | |
1068 | local closest = 1000000000 | |
1069 | for _,a in pairs(CamerasNotObstructed) do | |
1070 | local b = a.Target.Position | |
1071 | ||
1072 | local e = dis2(b.X, obj.X, b.Y, obj.Y, b.Z, obj.Z) | |
1073 | if e < closest then closest = e end | |
1074 | end | |
1075 | for _,a in pairs(CamerasNotObstructed) do | |
1076 | local b = a.Target.Position | |
1077 | ||
1078 | local e = dis2(b.X, obj.X, b.Y, obj.Y, b.Z, obj.Z) | |
1079 | if e == closest then | |
1080 | for _,p1 in pairs(_G.active_Objects.Cameras.ActiveCameras) do | |
1081 | if _ == a.Index then | |
1082 | AO.Cameras.CameraPosition = _ | |
1083 | workspace.CurrentCamera.CameraSubject = p1.Target | |
1084 | workspace.CurrentCamera.CFrame = CFrame.lookAt(p1.Target.Position,obj) | |
1085 | if _G.active_Objects.Cameras.Active == false then | |
1086 | for _,v in pairs(_G.active_Objects.Cameras.viewBegan.Connected_Functions) do | |
1087 | v.Func(p1.Target,p1.Extra) | |
1088 | end | |
1089 | end | |
1090 | for _,v in pairs(_G.active_Objects.Cameras.PositionChanged.Connected_Functions) do | |
1091 | v.Func(p1.Target,p1.Extra) | |
1092 | end | |
1093 | _G.active_Objects.Cameras.Active = true | |
1094 | _G.active_Objects.Viewing = p1.Target | |
1095 | end | |
1096 | end | |
1097 | end | |
1098 | end | |
1099 | end | |
1100 | end | |
1101 | end, | |
1102 | RefreshCam = function() | |
1103 | if workspace.CurrentCamera.CameraSubject ~= _G.active_Objects.Viewing then | |
1104 | workspace.CurrentCamera.CameraSubject = _G.active_Objects.Viewing | |
1105 | end | |
1106 | end, | |
1107 | } | |
1108 | ||
1109 | -- Listeners | |
1110 | local Command_Active = false | |
1111 | Player.Chatted:Connect(function(data) | |
1112 | local p1,p2,p3 = scs(data) | |
1113 | if p1 == true then | |
1114 | local p4, p5 | |
1115 | if Commands[p2:lower()] == nil then | |
1116 | else | |
1117 | if p3 ~= nil then | |
1118 | Command_Active = true | |
1119 | p4, p5 = Commands[p2:lower()](p3) | |
1120 | else | |
1121 | Command_Active = true | |
1122 | p4, p5 = Commands[p2:lower()]() | |
1123 | end | |
1124 | if p4 == true then | |
1125 | print("FXHub: " .. p5); | |
1126 | elseif p4 == nil then | |
1127 | error("FXHub: Command not found " .. p2); | |
1128 | end; | |
1129 | Command_Active = false | |
1130 | end | |
1131 | else | |
1132 | Command_Active = false | |
1133 | end; | |
1134 | end); | |
1135 | ||
1136 | UIS.InputBegan:Connect(function(p1,p2) | |
1137 | if p2 then | |
1138 | tb = true | |
1139 | end | |
1140 | end) | |
1141 | ||
1142 | UIS.InputEnded:Connect(function() | |
1143 | tb = false | |
1144 | end) | |
1145 | ||
1146 | ||
1147 | -- Main Loop | |
1148 | ||
1149 | Player.CharacterAdded:Connect(function(char) | |
1150 | wait(0.15) | |
1151 | if AO.Cameras.Active == false and AO.Freecam.Active == false then | |
1152 | AO.Viewing = char.Humanoid | |
1153 | pcall(function() | |
1154 | if RTP_TO ~= nil then | |
1155 | char.HumanoidRootPart.CFrame = RTP_TO | |
1156 | RTP_TO = nil | |
1157 | end | |
1158 | end) | |
1159 | end | |
1160 | end) | |
1161 | ||
1162 | game:GetService("RunService").Heartbeat:Connect(function(dt) | |
1163 | if Command_Active ~= true then | |
1164 | for _,p1 in pairs(looped_Commands) do | |
1165 | loop_Command[p1.Type](p1.Target,_,dt) | |
1166 | end; | |
1167 | end | |
1168 | loop_Command.RefreshCam() | |
1169 | end); | |
1170 | ||
1171 | ||
1172 | game:GetService("StarterGui"):SetCore("SendNotification", { | |
1173 | Title = "FXAdmin 2.5", | |
1174 | Text = "Executed Successfully.", | |
1175 | Duration = 60, | |
1176 | Button1 = "Ok", | |
1177 | }) |