Josiahiscool73

magic carper others fe

Nov 27th, 2025 (edited)
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.33 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local Workspace = game:GetService("Workspace")
  3. local RunService = game:GetService("RunService")
  4. local LocalPlayer = Players.LocalPlayer
  5. local Camera = Workspace.CurrentCamera
  6.  
  7. local Fly = {}
  8. Fly.__index = Fly
  9.  
  10. function Fly.new()
  11. local self = setmetatable({}, Fly)
  12.  
  13. self.Speed = 50
  14. self.Smoothness = 0.1
  15. self.Offset = -3.5
  16.  
  17. self.Active = false
  18. self.Recentering = false
  19. self.Target = nil
  20. self.Inputs = {Fwd=false, Bwd=false, Left=false, Right=false, Up=false, Down=false}
  21. self.Velocity = Vector3.new(0,0,0)
  22.  
  23. self.BodyVel = nil
  24. self.BodyGyro = nil
  25. self.NoclipConnection = nil
  26. self.VisualField = nil -- Stores the force field part
  27.  
  28. self.Gui = self:CreateUI()
  29. self:Events()
  30.  
  31. return self
  32. end
  33.  
  34. -- VISUALS: Creates the glowing force field
  35. function Fly:ToggleVisuals(enabled)
  36. if self.VisualField then
  37. self.VisualField:Destroy()
  38. self.VisualField = nil
  39. end
  40.  
  41. if enabled then
  42. local char = LocalPlayer.Character
  43. local root = char and char:FindFirstChild("HumanoidRootPart")
  44. if root then
  45. local ff = Instance.new("Part")
  46. ff.Name = "GhostField"
  47. ff.Shape = Enum.PartType.Ball
  48. -- Size: Slightly bigger than character (Character is roughly 5-6 studs tall)
  49. ff.Size = Vector3.new(9, 9, 9)
  50. ff.Material = Enum.Material.ForceField
  51. ff.Color = Color3.fromRGB(0, 255, 255) -- Cyan/Blue glow
  52. ff.Transparency = 0 -- ForceField material handles transparency automatically
  53. ff.CanCollide = false
  54. ff.Massless = true
  55. ff.CastShadow = false
  56. ff.Parent = char
  57.  
  58. -- Weld it to the player so it moves with you
  59. local weld = Instance.new("WeldConstraint")
  60. weld.Part0 = root
  61. weld.Part1 = ff
  62. weld.Parent = ff
  63.  
  64. self.VisualField = ff
  65. end
  66. end
  67. end
  68.  
  69. function Fly:HandleNoclip()
  70. if self.NoclipConnection then self.NoclipConnection:Disconnect() end
  71.  
  72. self.NoclipConnection = RunService.Stepped:Connect(function()
  73. if not self.Active then
  74. if self.NoclipConnection then self.NoclipConnection:Disconnect() end
  75. return
  76. end
  77.  
  78. local char = LocalPlayer.Character
  79. if not char then return end
  80. local root = char:FindFirstChild("HumanoidRootPart")
  81. if not root then return end
  82.  
  83. local fullNoclipMode = self.Recentering or self.Inputs.Up
  84.  
  85. -- 1. Character Collision
  86. for _, p in pairs(char:GetDescendants()) do
  87. if p:IsA("BasePart") and p.Name ~= "GhostField" then
  88. p.CanCollide = not fullNoclipMode
  89. end
  90. end
  91.  
  92. -- 2. Map Collision (Increased radius to 50 for smoother walking through walls)
  93. local parts = Workspace:GetPartBoundsInRadius(root.Position, 50)
  94.  
  95. for _, part in pairs(parts) do
  96. if part:IsA("BasePart") and not part:IsDescendantOf(char) then
  97. if fullNoclipMode then
  98. part.CanCollide = false
  99. else
  100. -- Check if it is a player
  101. local isPlayer = false
  102. for _, pl in pairs(Players:GetPlayers()) do
  103. if pl.Character and part:IsDescendantOf(pl.Character) then
  104. isPlayer = true
  105. break
  106. end
  107. end
  108.  
  109. if isPlayer then
  110. part.CanCollide = true
  111. else
  112. part.CanCollide = false
  113. end
  114. end
  115. end
  116. end
  117. end)
  118. end
  119.  
  120. function Fly:Start(target)
  121. local char = LocalPlayer.Character
  122. if not char then return end
  123. local root = char:FindFirstChild("HumanoidRootPart")
  124. local hum = char:FindFirstChild("Humanoid")
  125.  
  126. if root and hum and target.Character then
  127. self.Active = true
  128. self.Target = target
  129.  
  130. hum.PlatformStand = true
  131.  
  132. self.BodyGyro = Instance.new("BodyGyro")
  133. self.BodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
  134. self.BodyGyro.P = 20000
  135. self.BodyGyro.Parent = root
  136.  
  137. self.BodyVel = Instance.new("BodyVelocity")
  138. self.BodyVel.MaxForce = Vector3.new(9e9, 9e9, 9e9)
  139. self.BodyVel.Velocity = Vector3.new(0,0,0)
  140. self.BodyVel.Parent = root
  141.  
  142. self:ToggleVisuals(true) -- Turn on Force Field
  143. self:HandleNoclip()
  144.  
  145. task.spawn(function()
  146. if target.Character:FindFirstChild("HumanoidRootPart") then
  147. root.CFrame = target.Character.HumanoidRootPart.CFrame * CFrame.new(0, self.Offset, 0)
  148. end
  149. end)
  150. end
  151. end
  152.  
  153. function Fly:Fix()
  154. if not self.Active or not self.Target then return end
  155. local char = LocalPlayer.Character
  156. local tChar = self.Target.Character
  157.  
  158. if char and tChar and tChar:FindFirstChild("HumanoidRootPart") then
  159. local root = char:FindFirstChild("HumanoidRootPart")
  160.  
  161. root.CFrame = tChar.HumanoidRootPart.CFrame * CFrame.new(0, self.Offset, 0)
  162.  
  163. task.spawn(function()
  164. self.Recentering = true
  165. -- Change visual color to Red during recenter to show "Full Noclip"
  166. if self.VisualField then self.VisualField.Color = Color3.fromRGB(255, 0, 0) end
  167.  
  168. local duration = 3
  169. local startTime = os.clock()
  170.  
  171. while (os.clock() - startTime) < duration do
  172. local remaining = duration - (os.clock() - startTime)
  173. self.FixBtn.Text = string.format("%.2f", math.max(0, remaining))
  174. RunService.RenderStepped:Wait()
  175. end
  176.  
  177. -- Revert color
  178. if self.VisualField then self.VisualField.Color = Color3.fromRGB(0, 255, 255) end
  179.  
  180. self.FixBtn.Text = "RECENTER"
  181. self.Recentering = false
  182. end)
  183. end
  184. end
  185.  
  186. function Fly:Stop()
  187. self.Active = false
  188. self.Target = nil
  189. self.Recentering = false
  190.  
  191. if self.NoclipConnection then
  192. self.NoclipConnection:Disconnect()
  193. self.NoclipConnection = nil
  194. end
  195.  
  196. if self.BodyVel then self.BodyVel:Destroy() end
  197. if self.BodyGyro then self.BodyGyro:Destroy() end
  198.  
  199. self:ToggleVisuals(false) -- Turn off Force Field
  200.  
  201. local char = LocalPlayer.Character
  202. if char then
  203. local root = char:FindFirstChild("HumanoidRootPart")
  204. local hum = char:FindFirstChild("Humanoid")
  205.  
  206. if hum then
  207. hum.PlatformStand = false
  208. hum:ChangeState(Enum.HumanoidStateType.GettingUp)
  209. end
  210.  
  211. for _, p in pairs(char:GetDescendants()) do
  212. if p:IsA("BasePart") then p.CanCollide = true end
  213. end
  214.  
  215. -- GLOBAL FIX: Reset everything in a massive radius
  216. if root then
  217. local parts = Workspace:GetPartBoundsInRadius(root.Position, 500)
  218. for _, part in pairs(parts) do
  219. if part:IsA("BasePart") and not part:IsDescendantOf(char) then
  220. part.CanCollide = true
  221. end
  222. end
  223.  
  224. -- Safety Raycast for the floor directly under
  225. local params = RaycastParams.new()
  226. params.FilterDescendantsInstances = {char}
  227. params.FilterType = Enum.RaycastFilterType.Exclude
  228.  
  229. local ray = Workspace:Raycast(root.Position, Vector3.new(0, -1000, 0), params)
  230. if ray and ray.Instance then
  231. ray.Instance.CanCollide = true
  232. end
  233. end
  234. end
  235. end
  236.  
  237. function Fly:Update()
  238. if not self.Active or not self.BodyVel or not self.BodyGyro then return end
  239.  
  240. local cf = Camera.CFrame
  241. local dir = Vector3.new(0,0,0)
  242.  
  243. local flatLook = (cf.LookVector * Vector3.new(1,0,1)).Unit
  244. local flatRight = (cf.RightVector * Vector3.new(1,0,1)).Unit
  245.  
  246. if self.Inputs.Fwd then dir = dir + flatLook end
  247. if self.Inputs.Bwd then dir = dir - flatLook end
  248. if self.Inputs.Left then dir = dir - flatRight end
  249. if self.Inputs.Right then dir = dir + flatRight end
  250. if self.Inputs.Up then dir = dir + Vector3.new(0,1,0) end
  251. if self.Inputs.Down then dir = dir - Vector3.new(0,1,0) end
  252.  
  253. if dir.Magnitude > 0 then
  254. dir = dir.Unit * self.Speed
  255. end
  256.  
  257. self.Velocity = self.Velocity:Lerp(dir, self.Smoothness)
  258. self.BodyVel.Velocity = self.Velocity
  259.  
  260. local _, y, _ = cf:ToEulerAnglesYXZ()
  261. self.BodyGyro.CFrame = CFrame.Angles(0, y, 0) * CFrame.Angles(math.rad(-90), 0, 0)
  262. end
  263.  
  264. function Fly:Events()
  265. RunService.RenderStepped:Connect(function() self:Update() end)
  266.  
  267. local function Find(txt)
  268. for _, p in pairs(Players:GetPlayers()) do
  269. if p ~= LocalPlayer and (string.sub(string.lower(p.Name), 1, #txt) == string.lower(txt) or string.sub(string.lower(p.DisplayName), 1, #txt) == string.lower(txt)) then
  270. return p
  271. end
  272. end
  273. end
  274.  
  275. self.MainBtn.MouseButton1Click:Connect(function()
  276. if self.Active then
  277. self:Stop()
  278. self.MainBtn.Text = "START"
  279. self.MainBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  280. else
  281. local t = Find(self.Box.Text)
  282. if t then
  283. self:Start(t)
  284. self.MainBtn.Text = "STOP"
  285. self.MainBtn.BackgroundColor3 = Color3.fromRGB(150, 0, 0)
  286. else
  287. self.MainBtn.Text = "INVALID"
  288. task.wait(0.5)
  289. self.MainBtn.Text = "START"
  290. end
  291. end
  292. end)
  293.  
  294. self.FixBtn.MouseButton1Click:Connect(function()
  295. self:Fix()
  296. end)
  297.  
  298. self.SpeedBtn.MouseButton1Click:Connect(function()
  299. if self.Speed == 20 then
  300. self.Speed = 50
  301. self.SpeedBtn.Text = "SPEED: 50"
  302. elseif self.Speed == 50 then
  303. self.Speed = 100
  304. self.SpeedBtn.Text = "SPEED: 100"
  305. else
  306. self.Speed = 20
  307. self.SpeedBtn.Text = "SPEED: 20"
  308. end
  309. end)
  310.  
  311. local function Bind(btn, key)
  312. btn.MouseButton1Down:Connect(function() self.Inputs[key] = true end)
  313. btn.MouseButton1Up:Connect(function() self.Inputs[key] = false end)
  314. btn.MouseLeave:Connect(function() self.Inputs[key] = false end)
  315. end
  316.  
  317. Bind(self.W, "Fwd")
  318. Bind(self.S, "Bwd")
  319. Bind(self.A, "Left")
  320. Bind(self.D, "Right")
  321. Bind(self.U, "Up")
  322. Bind(self.Dwn, "Down")
  323.  
  324. LocalPlayer.CharacterAdded:Connect(function() self:Stop() end)
  325. end
  326.  
  327. function Fly:CreateUI()
  328. if LocalPlayer.PlayerGui:FindFirstChild("FlyInterface") then LocalPlayer.PlayerGui.FlyInterface:Destroy() end
  329.  
  330. local Gui = Instance.new("ScreenGui")
  331. Gui.Name = "FlyInterface"
  332. Gui.ResetOnSpawn = false
  333. Gui.Parent = LocalPlayer:WaitForChild("PlayerGui")
  334.  
  335. local Main = Instance.new("Frame")
  336. Main.Size = UDim2.new(0, 200, 0, 300)
  337. Main.Position = UDim2.new(0.05, 0, 0.3, 0)
  338. Main.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
  339. Main.BorderSizePixel = 2
  340. Main.BorderColor3 = Color3.fromRGB(60, 60, 60)
  341. Main.Active = true
  342. Main.Draggable = true
  343. Main.Parent = Gui
  344.  
  345. local Title = Instance.new("TextLabel")
  346. Title.Text = "CONTROLLER"
  347. Title.Size = UDim2.new(1, 0, 0, 25)
  348. Title.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  349. Title.TextColor3 = Color3.fromRGB(200, 200, 200)
  350. Title.Font = Enum.Font.SourceSansBold
  351. Title.TextSize = 14
  352. Title.BorderSizePixel = 0
  353. Title.Parent = Main
  354.  
  355. self.Box = Instance.new("TextBox")
  356. self.Box.Size = UDim2.new(0.9, 0, 0, 30)
  357. self.Box.Position = UDim2.new(0.05, 0, 0.1, 0)
  358. self.Box.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  359. self.Box.TextColor3 = Color3.fromRGB(255, 255, 255)
  360. self.Box.PlaceholderText = "User"
  361. self.Box.BorderSizePixel = 1
  362. self.Box.BorderColor3 = Color3.fromRGB(80, 80, 80)
  363. self.Box.Parent = Main
  364.  
  365. self.MainBtn = Instance.new("TextButton")
  366. self.MainBtn.Text = "START"
  367. self.MainBtn.Size = UDim2.new(0.9, 0, 0, 35)
  368. self.MainBtn.Position = UDim2.new(0.05, 0, 0.22, 0)
  369. self.MainBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  370. self.MainBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
  371. self.MainBtn.Font = Enum.Font.SourceSansBold
  372. self.MainBtn.TextSize = 18
  373. self.MainBtn.BorderSizePixel = 1
  374. self.MainBtn.BorderColor3 = Color3.fromRGB(80, 80, 80)
  375. self.MainBtn.Parent = Main
  376.  
  377. self.FixBtn = Instance.new("TextButton")
  378. self.FixBtn.Text = "RECENTER"
  379. self.FixBtn.Size = UDim2.new(0.9, 0, 0, 30)
  380. self.FixBtn.Position = UDim2.new(0.05, 0, 0.36, 0)
  381. self.FixBtn.BackgroundColor3 = Color3.fromRGB(180, 100, 0)
  382. self.FixBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
  383. self.FixBtn.Font = Enum.Font.SourceSansBold
  384. self.FixBtn.BorderSizePixel = 1
  385. self.FixBtn.BorderColor3 = Color3.fromRGB(80, 80, 80)
  386. self.FixBtn.Parent = Main
  387.  
  388. self.SpeedBtn = Instance.new("TextButton")
  389. self.SpeedBtn.Text = "SPEED: 50"
  390. self.SpeedBtn.Size = UDim2.new(0.9, 0, 0, 25)
  391. self.SpeedBtn.Position = UDim2.new(0.05, 0, 0.48, 0)
  392. self.SpeedBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  393. self.SpeedBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
  394. self.SpeedBtn.Font = Enum.Font.SourceSans
  395. self.SpeedBtn.BorderSizePixel = 1
  396. self.SpeedBtn.BorderColor3 = Color3.fromRGB(80, 80, 80)
  397. self.SpeedBtn.Parent = Main
  398.  
  399. self.U = Instance.new("TextButton")
  400. self.U.Text = "^"
  401. self.U.Size = UDim2.new(0.42, 0, 0, 30)
  402. self.U.Position = UDim2.new(0.05, 0, 0.58, 0)
  403. self.U.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
  404. self.U.TextColor3 = Color3.fromRGB(255, 255, 255)
  405. self.U.BorderSizePixel = 1
  406. self.U.BorderColor3 = Color3.fromRGB(80, 80, 80)
  407. self.U.Parent = Main
  408.  
  409. self.Dwn = Instance.new("TextButton")
  410. self.Dwn.Text = "v"
  411. self.Dwn.Size = UDim2.new(0.42, 0, 0, 30)
  412. self.Dwn.Position = UDim2.new(0.53, 0, 0.58, 0)
  413. self.Dwn.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
  414. self.Dwn.TextColor3 = Color3.fromRGB(255, 255, 255)
  415. self.Dwn.BorderSizePixel = 1
  416. self.Dwn.BorderColor3 = Color3.fromRGB(80, 80, 80)
  417. self.Dwn.Parent = Main
  418.  
  419. local Pad = Instance.new("Frame")
  420. Pad.Size = UDim2.new(0.8, 0, 0.25, 0)
  421. Pad.Position = UDim2.new(0.1, 0, 0.7, 0)
  422. Pad.BackgroundTransparency = 1
  423. Pad.Parent = Main
  424.  
  425. self.W = Instance.new("TextButton")
  426. self.W.Text = "W"
  427. self.W.Size = UDim2.new(0.3, 0, 0.45, 0)
  428. self.W.Position = UDim2.new(0.35, 0, 0, 0)
  429. self.W.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  430. self.W.TextColor3 = Color3.fromRGB(255, 255, 255)
  431. self.W.BorderSizePixel = 1
  432. self.W.BorderColor3 = Color3.fromRGB(80, 80, 80)
  433. self.W.Parent = Pad
  434.  
  435. self.S = Instance.new("TextButton")
  436. self.S.Text = "S"
  437. self.S.Size = UDim2.new(0.3, 0, 0.45, 0)
  438. self.S.Position = UDim2.new(0.35, 0, 0.55, 0)
  439. self.S.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  440. self.S.TextColor3 = Color3.fromRGB(255, 255, 255)
  441. self.S.BorderSizePixel = 1
  442. self.S.BorderColor3 = Color3.fromRGB(80, 80, 80)
  443. self.S.Parent = Pad
  444.  
  445. self.A = Instance.new("TextButton")
  446. self.A.Text = "A"
  447. self.A.Size = UDim2.new(0.3, 0, 0.45, 0)
  448. self.A.Position = UDim2.new(0, 0, 0.55, 0)
  449. self.A.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  450. self.A.TextColor3 = Color3.fromRGB(255, 255, 255)
  451. self.A.BorderSizePixel = 1
  452. self.A.BorderColor3 = Color3.fromRGB(80, 80, 80)
  453. self.A.Parent = Pad
  454.  
  455. self.D = Instance.new("TextButton")
  456. self.D.Text = "D"
  457. self.D.Size = UDim2.new(0.3, 0, 0.45, 0)
  458. self.D.Position = UDim2.new(0.7, 0, 0.55, 0)
  459. self.D.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  460. self.D.TextColor3 = Color3.fromRGB(255, 255, 255)
  461. self.D.BorderSizePixel = 1
  462. self.D.BorderColor3 = Color3.fromRGB(80, 80, 80)
  463. self.D.Parent = Pad
  464.  
  465. return Gui
  466. end
  467.  
  468. local Controller = Fly.new()
Advertisement
Add Comment
Please, Sign In to add comment