Advertisement
Guest User

Car Crash System Script Hub

a guest
Nov 30th, 2022
1,167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.19 KB | None | 0 0
  1. local Rayfield = loadstring(game:HttpGet('https://raw.githubusercontent.com/shlexware/Rayfield/main/source'))()
  2.  
  3. local Window = Rayfield:CreateWindow({
  4. Name = "DevHub",
  5. LoadingTitle = "DevHub",
  6. LoadingSubtitle = "by HevX",
  7. ConfigurationSaving = {
  8. Enabled = true,
  9. FolderName = nil, -- Create a custom folder for your hub/game
  10. FileName = "DevHub"
  11. },
  12. Discord = {
  13. Enabled = true,
  14. Invite = "ftMc57WuGd", -- The Discord invite code, do not include discord.gg/
  15. RememberJoins = true -- Set this to false to make them join the discord every time they load it up
  16. },
  17. KeySystem = false, -- Set this to true to use our key system
  18. KeySettings = {
  19. Title = "DevHub",
  20. Subtitle = "Key System",
  21. Note = "Welcome!",
  22. FileName = "Key",
  23. SaveKey = false,
  24. GrabKeyFromSite = false, -- If this is true, set Key below to the RAW site you would like Rayfield to get the key from
  25. Key = "s6v9y$B&E)H@McQfTjWnZq4t7w!z%C*F-JaNdRgUkXp2s5u8x/A?D(G+KbPeShVm"
  26. }
  27. })
  28.  
  29. local Tab = Window:CreateTab("Tier 2", 4483362458) -- Title, Image
  30. local Section = Tab:CreateSection("Tier 2")
  31. local Button = Tab:CreateButton({
  32. Name = "Tuned Tyrota Cupra",
  33. Callback = function()
  34. -- Script generated by SimpleSpy - credits to exx#9394
  35.  
  36. local args = {
  37. [1] = "[TIER 2] Tyrota cupra"
  38. }
  39.  
  40. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  41.  
  42.  
  43. -- The function that takes place when the button is pressed
  44. end,
  45. })
  46.  
  47. local Button = Tab:CreateButton({
  48. Name = "Tuned Sedan",
  49. Callback = function()
  50. -- Script generated by SimpleSpy - credits to exx#9394
  51.  
  52. local args = {
  53. [1] = "[TIER 2] Sedan"
  54. }
  55.  
  56. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  57.  
  58. -- The function that takes place when the button is pressed
  59. end,
  60. })
  61.  
  62. local Button = Tab:CreateButton({
  63. Name = "Tuned Cab",
  64. Callback = function()
  65. -- Script generated by SimpleSpy - credits to exx#9394
  66.  
  67. local args = {
  68. [1] = "[TIER 2] Cab"
  69. }
  70.  
  71. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  72.  
  73. -- The function that takes place when the button is pressed
  74. end,
  75. })
  76.  
  77. local Button = Tab:CreateButton({
  78. Name = "Protected Sedan",
  79. Callback = function()
  80. -- Script generated by SimpleSpy - credits to exx#9394
  81.  
  82. local args = {
  83. [1] = "[TIER 2] Protected Sedan"
  84. }
  85.  
  86. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  87.  
  88. -- The function that takes place when the button is pressed
  89. end,
  90. })
  91.  
  92. local Button = Tab:CreateButton({
  93. Name = "SWAT Station Truck",
  94. Callback = function()
  95. -- Script generated by SimpleSpy - credits to exx#9394
  96.  
  97. local args = {
  98. [1] = "[TIER 2] SWAT truck"
  99. }
  100.  
  101. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  102.  
  103. -- The function that takes place when the button is pressed
  104. end,
  105. })
  106.  
  107. local Button = Tab:CreateButton({
  108. Name = "Big Sedan",
  109. Callback = function()
  110. -- Script generated by SimpleSpy - credits to exx#9394
  111.  
  112. local args = {
  113. [1] = "[TIER 2] Big Sedan"
  114. }
  115.  
  116. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  117.  
  118. -- The function that takes place when the button is pressed
  119. end,
  120. })
  121.  
  122. local Button = Tab:CreateButton({
  123. Name = "Tuned Tyrota Chest",
  124. Callback = function()
  125. -- Script generated by SimpleSpy - credits to exx#9394
  126.  
  127. local args = {
  128. [1] = "[TIER 2] Tyrota chest"
  129. }
  130.  
  131. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  132.  
  133. -- The function that takes place when the button is pressed
  134. end,
  135. })
  136.  
  137. local Button = Tab:CreateButton({
  138. Name = "[NUKE] Fuel Truck",
  139. Callback = function()
  140. -- Script generated by SimpleSpy - credits to exx#9394
  141.  
  142. local args = {
  143. [1] = "[TIER 2] Fuel truck"
  144. }
  145.  
  146. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  147.  
  148.  
  149. -- The function that takes place when the button is pressed
  150. end,
  151. })
  152.  
  153. local Button = Tab:CreateButton({
  154. Name = "Cherry Truck (2 Trailer)",
  155. Callback = function()
  156. -- Script generated by SimpleSpy - credits to exx#9394
  157.  
  158. local args = {
  159. [1] = "[TIER 2] Truck trailer"
  160. }
  161.  
  162. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  163.  
  164. -- The function that takes place when the button is pressed
  165. end,
  166. })
  167.  
  168. local Button = Tab:CreateButton({
  169. Name = "Armored Dodged Roger",
  170. Callback = function()
  171. -- Script generated by SimpleSpy - credits to exx#9394
  172.  
  173. local args = {
  174. [1] = "[TIER 2] Dodged Roger"
  175. }
  176.  
  177. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  178.  
  179. -- The function that takes place when the button is pressed
  180. end,
  181. })
  182.  
  183. local Button = Tab:CreateButton({
  184. Name = "Tuned Dirt Bike",
  185. Callback = function()
  186. -- Script generated by SimpleSpy - credits to exx#9394
  187.  
  188. local args = {
  189. [1] = "[TIER 2] Dirt bike"
  190. }
  191.  
  192. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  193.  
  194. -- The function that takes place when the button is pressed
  195. end,
  196. })
  197.  
  198. local Button = Tab:CreateButton({
  199. Name = "Tuned Cobra Simic",
  200. Callback = function()
  201. -- Script generated by SimpleSpy - credits to exx#9394
  202.  
  203. local args = {
  204. [1] = "[TIER 2] Cobra Simic"
  205. }
  206.  
  207. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  208.  
  209. -- The function that takes place when the button is pressed
  210. end,
  211. })
  212.  
  213. local Button = Tab:CreateButton({
  214. Name = "Tuned Lemon Door",
  215. Callback = function()
  216. -- Script generated by SimpleSpy - credits to exx#9394
  217.  
  218. local args = {
  219. [1] = "[TIER 2] Lemon door"
  220. }
  221.  
  222. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  223.  
  224. -- The function that takes place when the button is pressed
  225. end,
  226. })
  227.  
  228. local Button = Tab:CreateButton({
  229. Name = "Tuned Bus",
  230. Callback = function()
  231. -- Script generated by SimpleSpy - credits to exx#9394
  232.  
  233. local args = {
  234. [1] = "[TIER 2] Bus"
  235. }
  236.  
  237. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  238.  
  239. -- The function that takes place when the button is pressed
  240. end,
  241. })
  242.  
  243. local Tab = Window:CreateTab("Tier 3", 4483362458) -- Title, Image
  244. local Section = Tab:CreateSection("Tier 3")
  245. local Button = Tab:CreateButton({
  246. Name = "Mining Truck",
  247. Callback = function()
  248. -- Script generated by SimpleSpy - credits to exx#9394
  249.  
  250. local args = {
  251. [1] = "[TIER 3] Mining truck"
  252. }
  253.  
  254. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  255.  
  256.  
  257. -- The function that takes place when the button is pressed
  258. end,
  259. })
  260.  
  261. local Button = Tab:CreateButton({
  262. Name = "ThrusterSSC",
  263. Callback = function()
  264. -- Script generated by SimpleSpy - credits to exx#9394
  265.  
  266. local args = {
  267. [1] = "[TIER 3] ThrusterSSC"
  268. }
  269.  
  270. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  271.  
  272. -- The function that takes place when the button is pressed
  273. end,
  274. })
  275.  
  276. local Button = Tab:CreateButton({
  277. Name = "Tank",
  278. Callback = function()
  279. -- Script generated by SimpleSpy - credits to exx#9394
  280.  
  281. local args = {
  282. [1] = "[TIER 3] Tank"
  283. }
  284.  
  285. game:GetService("ReplicatedStorage").SpawnCar:FireServer(unpack(args))
  286.  
  287. -- The function that takes place when the button is pressed
  288. end,
  289. })
  290.  
  291. local Tab = Window:CreateTab("Trolling", 4483362458) -- Title, Image
  292. local Section = Tab:CreateSection("Trolling")
  293.  
  294. local Button = Tab:CreateButton({
  295. Name = "Telekinesis",
  296. Callback = function()
  297. -- Q & E - bring closer and further
  298. -- R - Roates Block
  299. -- T - Tilts Block
  300. -- Y - Throws Block
  301. local function a(b, c)
  302. local d = getfenv(c)
  303. local e =
  304. setmetatable(
  305. {},
  306. {__index = function(self, f)
  307. if f == "script" then
  308. return b
  309. else
  310. return d[f]
  311. end
  312. end}
  313. )
  314. setfenv(c, e)
  315. return c
  316. end
  317. local g = {}
  318. local h = Instance.new("Model", game:GetService("Lighting"))
  319. local i = Instance.new("Tool")
  320. local j = Instance.new("Part")
  321. local k = Instance.new("Script")
  322. local l = Instance.new("LocalScript")
  323. local m = sethiddenproperty or set_hidden_property
  324. i.Name = "Telekinesis"
  325. i.Parent = h
  326. i.Grip = CFrame.new(0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
  327. i.GripForward = Vector3.new(-0, -1, -0)
  328. i.GripRight = Vector3.new(0, 0, 1)
  329. i.GripUp = Vector3.new(1, 0, 0)
  330. j.Name = "Handle"
  331. j.Parent = i
  332. j.CFrame = CFrame.new(-17.2635937, 15.4915619, 46, 0, 1, 0, 1, 0, 0, 0, 0, -1)
  333. j.Orientation = Vector3.new(0, 180, 90)
  334. j.Position = Vector3.new(-17.2635937, 15.4915619, 46)
  335. j.Rotation = Vector3.new(-180, 0, -90)
  336. j.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  337. j.Transparency = 1
  338. j.Size = Vector3.new(1, 1.20000005, 1)
  339. j.BottomSurface = Enum.SurfaceType.Weld
  340. j.BrickColor = BrickColor.new("Really black")
  341. j.Material = Enum.Material.Metal
  342. j.TopSurface = Enum.SurfaceType.Smooth
  343. j.brickColor = BrickColor.new("Really black")
  344. k.Name = "LineConnect"
  345. k.Parent = i
  346. table.insert(
  347. g,
  348. a(
  349. k,
  350. function()
  351. wait()
  352. local n = script.Part2
  353. local o = script.Part1.Value
  354. local p = script.Part2.Value
  355. local q = script.Par.Value
  356. local color = script.Color
  357. local r = Instance.new("Part")
  358. r.TopSurface = 0
  359. r.BottomSurface = 0
  360. r.Reflectance = .5
  361. r.Name = "Laser"
  362. r.Locked = true
  363. r.CanCollide = false
  364. r.Anchored = true
  365. r.formFactor = 0
  366. r.Size = Vector3.new(1, 1, 1)
  367. local s = Instance.new("BlockMesh")
  368. s.Parent = r
  369. while true do
  370. if n.Value == nil then
  371. break
  372. end
  373. if o == nil or p == nil or q == nil then
  374. break
  375. end
  376. if o.Parent == nil or p.Parent == nil then
  377. break
  378. end
  379. if q.Parent == nil then
  380. break
  381. end
  382. local t = CFrame.new(o.Position, p.Position)
  383. local dist = (o.Position - p.Position).magnitude
  384. r.Parent = q
  385. r.BrickColor = color.Value.BrickColor
  386. r.Reflectance = color.Value.Reflectance
  387. r.Transparency = color.Value.Transparency
  388. r.CFrame = CFrame.new(o.Position + t.lookVector * dist / 2)
  389. r.CFrame = CFrame.new(r.Position, p.Position)
  390. s.Scale = Vector3.new(.25, .25, dist)
  391. wait()
  392. end
  393. r:remove()
  394. script:remove()
  395. end
  396. )
  397. )
  398. k.Disabled = true
  399. l.Name = "MainScript"
  400. l.Parent = i
  401. table.insert(
  402. g,
  403. a(
  404. l,
  405. function()
  406. wait()
  407. tool = script.Parent
  408. lineconnect = tool.LineConnect
  409. object = nil
  410. mousedown = false
  411. found = false
  412. BP = Instance.new("BodyPosition")
  413. BP.maxForce = Vector3.new(math.huge * math.huge, math.huge * math.huge, math.huge * math.huge)
  414. BP.P = BP.P * 1.1
  415. dist = nil
  416. point = Instance.new("Part")
  417. point.Locked = true
  418. point.Anchored = true
  419. point.formFactor = 0
  420. point.Shape = 0
  421. point.BrickColor = BrickColor.Black()
  422. point.Size = Vector3.new(1, 1, 1)
  423. point.CanCollide = false
  424. local s = Instance.new("SpecialMesh")
  425. s.MeshType = "Sphere"
  426. s.Scale = Vector3.new(.7, .7, .7)
  427. s.Parent = point
  428. handle = tool.Handle
  429. front = tool.Handle
  430. color = tool.Handle
  431. objval = nil
  432. local u = false
  433. local v = BP:clone()
  434. v.maxForce = Vector3.new(30000, 30000, 30000)
  435. function LineConnect(o, p, q)
  436. local w = Instance.new("ObjectValue")
  437. w.Value = o
  438. w.Name = "Part1"
  439. local x = Instance.new("ObjectValue")
  440. x.Value = p
  441. x.Name = "Part2"
  442. local y = Instance.new("ObjectValue")
  443. y.Value = q
  444. y.Name = "Par"
  445. local z = Instance.new("ObjectValue")
  446. z.Value = color
  447. z.Name = "Color"
  448. local A = lineconnect:clone()
  449. A.Disabled = false
  450. w.Parent = A
  451. x.Parent = A
  452. y.Parent = A
  453. z.Parent = A
  454. A.Parent = workspace
  455. if p == object then
  456. objval = x
  457. end
  458. end
  459. function onButton1Down(B)
  460. if mousedown == true then
  461. return
  462. end
  463. mousedown = true
  464. coroutine.resume(
  465. coroutine.create(
  466. function()
  467. local C = point:clone()
  468. C.Parent = tool
  469. LineConnect(front, C, workspace)
  470. while mousedown == true do
  471. C.Parent = tool
  472. if object == nil then
  473. if B.Target == nil then
  474. local t = CFrame.new(front.Position, B.Hit.p)
  475. C.CFrame = CFrame.new(front.Position + t.lookVector * 1000)
  476. else
  477. C.CFrame = CFrame.new(B.Hit.p)
  478. end
  479. else
  480. LineConnect(front, object, workspace)
  481. break
  482. end
  483. wait()
  484. end
  485. C:remove()
  486. end
  487. )
  488. )
  489. while mousedown == true do
  490. if B.Target ~= nil then
  491. local D = B.Target
  492. if D.Anchored == false then
  493. object = D
  494. dist = (object.Position - front.Position).magnitude
  495. break
  496. end
  497. end
  498. wait()
  499. end
  500. while mousedown == true do
  501. if object.Parent == nil then
  502. break
  503. end
  504. local t = CFrame.new(front.Position, B.Hit.p)
  505. BP.Parent = object
  506. BP.position = front.Position + t.lookVector * dist
  507. wait()
  508. end
  509. BP:remove()
  510. object = nil
  511. objval.Value = nil
  512. end
  513. function onKeyDown(E, B)
  514. local E = E:lower()
  515. local F = false
  516. if E == "q" then
  517. if dist >= 5 then
  518. dist = dist - 10
  519. end
  520. end
  521. if E == "r" then
  522. if object == nil then
  523. return
  524. end
  525. for G, H in pairs(object:children()) do
  526. if H.className == "BodyGyro" then
  527. return nil
  528. end
  529. end
  530. BG = Instance.new("BodyGyro")
  531. BG.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  532. BG.cframe = CFrame.new(object.CFrame.p)
  533. BG.Parent = object
  534. repeat
  535. wait()
  536. until object.CFrame == CFrame.new(object.CFrame.p)
  537. BG.Parent = nil
  538. if object == nil then
  539. return
  540. end
  541. for G, H in pairs(object:children()) do
  542. if H.className == "BodyGyro" then
  543. H.Parent = nil
  544. end
  545. end
  546. object.Velocity = Vector3.new(0, 0, 0)
  547. object.RotVelocity = Vector3.new(0, 0, 0)
  548. object.Orientation = Vector3.new(0, 0, 0)
  549. end
  550. if E == "e" then
  551. dist = dist + 10
  552. end
  553. if E == "t" then
  554. if dist ~= 10 then
  555. dist = 10
  556. end
  557. end
  558. if E == "y" then
  559. if dist ~= 200 then
  560. dist = 200
  561. end
  562. end
  563. if E == "=" then
  564. BP.P = BP.P * 1.5
  565. end
  566. if E == "-" then
  567. BP.P = BP.P * 0.5
  568. end
  569. end
  570. function onEquipped(B)
  571. keymouse = B
  572. local I = tool.Parent
  573. human = I.Humanoid
  574. human.Changed:connect(
  575. function()
  576. if human.Health == 0 then
  577. mousedown = false
  578. BP:remove()
  579. point:remove()
  580. tool:remove()
  581. end
  582. end
  583. )
  584. B.Button1Down:connect(
  585. function()
  586. onButton1Down(B)
  587. end
  588. )
  589. B.Button1Up:connect(
  590. function()
  591. mousedown = false
  592. end
  593. )
  594. B.KeyDown:connect(
  595. function(E)
  596. onKeyDown(E, B)
  597. end
  598. )
  599. B.Icon = "rbxasset://textures\\GunCursor.png"
  600. end
  601. tool.Equipped:connect(onEquipped)
  602. end
  603. )
  604. )
  605. for J, H in pairs(h:GetChildren()) do
  606. H.Parent = game:GetService("Players").LocalPlayer.Backpack
  607. pcall(
  608. function()
  609. H:MakeJoints()
  610. end
  611. )
  612. end
  613. h:Destroy()
  614. for J, H in pairs(g) do
  615. spawn(
  616. function()
  617. pcall(H)
  618. end
  619. )
  620. end
  621.  
  622. Rayfield:Notify({
  623. Title = "Controls",
  624. Content = "Q and E = Bring Closer And Further / R = Rotate The Block / Y = Throws The Block",
  625. Duration = 50.5,
  626. Image = 4483362458,
  627. Actions = { -- Notification Buttons
  628. Ignore = {
  629. Name = "Okay!",
  630. Callback = function()
  631. print("The user tapped Okay!")
  632. end
  633. },
  634. },
  635. })
  636. -- The function that takes place when the button is pressed
  637. end,
  638. })
  639.  
  640. local Paragraph = Tab:CreateParagraph({Title = "Will be added more soon!", Content = "Coming Soon..."})
  641.  
  642.  
  643. local Tab = Window:CreateTab("Misc", 4483362458) -- Title, Image
  644. local Section = Tab:CreateSection("Misc")
  645. local Slider = Tab:CreateSlider({
  646. Name = "Walkspeed",
  647. Range = {0, 150},
  648. Increment = 1,
  649. Suffix = "Walkspeed",
  650. CurrentValue = 16,
  651. Flag = "Slider1", -- A flag is the identifier for the configuration file, make sure every element has a different flag if you're using configuration saving to ensure no overlaps
  652. Callback = function(Value)
  653. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = Value
  654. -- The function that takes place when the slider changes
  655. -- The variable (Value) is a number which correlates to the value the slider is currently at
  656. end,
  657. })
  658.  
  659. local Button = Tab:CreateButton({
  660. Name = "Anti-AFK",
  661. Callback = function()
  662. local vu = game:GetService("VirtualUser")
  663. game:GetService("Players").LocalPlayer.Idled:connect(function()
  664. vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  665. wait(1)
  666. vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  667. end)
  668. -- The function that takes place when the button is pressed
  669. end,
  670. })
  671.  
  672. local Button = Tab:CreateButton({
  673. Name = "Fly",
  674. Callback = function()
  675. repeat wait()
  676. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  677. local mouse = game.Players.LocalPlayer:GetMouse()
  678. repeat wait() until mouse
  679. local plr = game.Players.LocalPlayer
  680. local torso = plr.Character.Torso
  681. local flying = true
  682. local deb = true
  683. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  684. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  685. local maxspeed = 50
  686. local speed = 0
  687.  
  688. function Fly()
  689. local bg = Instance.new("BodyGyro", torso)
  690. bg.P = 9e4
  691. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  692. bg.cframe = torso.CFrame
  693. local bv = Instance.new("BodyVelocity", torso)
  694. bv.velocity = Vector3.new(0,0.1,0)
  695. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  696. repeat wait()
  697. plr.Character.Humanoid.PlatformStand = true
  698. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  699. speed = speed+.5+(speed/maxspeed)
  700. if speed > maxspeed then
  701. speed = maxspeed
  702. end
  703. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  704. speed = speed-1
  705. if speed < 0 then
  706. speed = 0
  707. end
  708. end
  709. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  710. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  711. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  712. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  713. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  714. else
  715. bv.velocity = Vector3.new(0,0.1,0)
  716. end
  717. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  718. until not flying
  719. ctrl = {f = 0, b = 0, l = 0, r = 0}
  720. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  721. speed = 0
  722. bg:Destroy()
  723. bv:Destroy()
  724. plr.Character.Humanoid.PlatformStand = false
  725. end
  726. mouse.KeyDown:connect(function(key)
  727. if key:lower() == "e" then
  728. if flying then flying = false
  729. else
  730. flying = true
  731. Fly()
  732. end
  733. elseif key:lower() == "w" then
  734. ctrl.f = 1
  735. elseif key:lower() == "s" then
  736. ctrl.b = -1
  737. elseif key:lower() == "a" then
  738. ctrl.l = -1
  739. elseif key:lower() == "d" then
  740. ctrl.r = 1
  741. end
  742. end)
  743. mouse.KeyUp:connect(function(key)
  744. if key:lower() == "w" then
  745. ctrl.f = 0
  746. elseif key:lower() == "s" then
  747. ctrl.b = 0
  748. elseif key:lower() == "a" then
  749. ctrl.l = 0
  750. elseif key:lower() == "d" then
  751. ctrl.r = 0
  752. end
  753. end)
  754. Fly()
  755.  
  756. Rayfield:Notify({
  757. Title = "Notification",
  758. Content = "Press E to fly / unfly",
  759. Duration = 50.5,
  760. Image = 4483362458,
  761. Actions = { -- Notification Buttons
  762. Ignore = {
  763. Name = "Okay!",
  764. Callback = function()
  765. print("The user tapped Okay!")
  766. end
  767. },
  768. },
  769. })
  770. -- The function that takes place when the button is pressed
  771. end,
  772. })
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement