Advertisement
mattofm

Lumber Tycoon 2 Script

Aug 31st, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.87 KB | None | 0 0
  1. -- By JAZONE --
  2.  
  3. local RootS = Instance.new("ScreenGui")
  4. local OpenFrame = Instance.new("Frame")
  5. local Open = Instance.new("TextButton")
  6. local Main = Instance.new("Frame")
  7. local NoClip = Instance.new("TextButton")
  8. local ModWood = Instance.new("TextButton")
  9. local SellWood = Instance.new("TextButton")
  10. local AxeDupe = Instance.new("TextButton")
  11. local RemoveTrees = Instance.new("TextButton")
  12. local AntiBLAll = Instance.new("TextButton")
  13. local TPWood = Instance.new("TextButton")
  14. local RooTsV1 = Instance.new("TextLabel")
  15. local BYJAYZONE = Instance.new("TextLabel")
  16. local Fly = Instance.new("TextButton")
  17. local Close = Instance.new("TextButton")
  18.  
  19.  
  20. RootS.Name = "RootS"
  21. RootS.Parent = game.CoreGui
  22.  
  23. OpenFrame.Name = "OpenFrame"
  24. OpenFrame.Parent = RootS
  25. OpenFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  26. OpenFrame.BackgroundTransparency = 0.450
  27. OpenFrame.BorderColor3 = Color3.fromRGB(161, 68, 177)
  28. OpenFrame.BorderSizePixel = 5
  29. OpenFrame.Position = UDim2.new(0.456653237, 0, 0.921404719, 0)
  30. OpenFrame.Size = UDim2.new(0, 171, 0, 36)
  31.  
  32. Open.Name = "Open"
  33. Open.Parent = OpenFrame
  34. Open.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  35. Open.BackgroundTransparency = 0.650
  36. Open.BorderColor3 = Color3.fromRGB(161, 68, 177)
  37. Open.BorderSizePixel = 3
  38. Open.Position = UDim2.new(0.122807033, 0, 0.138888896, 0)
  39. Open.Size = UDim2.new(0, 128, 0, 25)
  40. Open.Font = Enum.Font.SourceSans
  41. Open.Text = "Open"
  42. Open.TextColor3 = Color3.fromRGB(161, 68, 177)
  43. Open.TextSize = 14.000
  44. Open.MouseButton1Down:Connect(function()
  45. OpenFrame.Visible = false
  46. Main.Visible = true
  47. end)
  48.  
  49. Main.Name = "Main"
  50. Main.Parent = RootS
  51. Main.Active = true
  52. Main.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  53. Main.BackgroundTransparency = 0.450
  54. Main.BorderColor3 = Color3.fromRGB(161, 68, 177)
  55. Main.Position = UDim2.new(0.0170093849, 0, 0.341137111, 0)
  56. Main.Size = UDim2.new(0, 238, 0, 377)
  57. Main.Visible = false
  58. Main.Draggable = true
  59.  
  60. NoClip.Name = "NoClip"
  61. NoClip.Parent = Main
  62. NoClip.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  63. NoClip.BackgroundTransparency = 0.750
  64. NoClip.BorderColor3 = Color3.fromRGB(161, 68, 177)
  65. NoClip.Position = UDim2.new(0.525826454, 0, 0.164756626, 0)
  66. NoClip.Size = UDim2.new(0, 87, 0, 49)
  67. NoClip.Font = Enum.Font.SourceSans
  68. NoClip.Text = "NoClip"
  69. NoClip.TextColor3 = Color3.fromRGB(161, 68, 177)
  70. NoClip.TextSize = 14.000
  71. NoClip.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  72. NoClip.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  73. NoClip.MouseButton1Down:connect(function()
  74. --No Clip
  75.  
  76. _G.noclip = false
  77. game:GetService('RunService').Stepped:connect(function()
  78. if noclip then
  79. game.Players.LocalPlayer.Character.Humanoid:ChangeState(11)
  80. NoClip.TextColor3 = Color3.fromRGB(161, 68, 177)
  81. end
  82. end)
  83. NoClip.MouseButton1Down:connect(function()
  84. noclip = not noclip
  85. NoClip.TextColor3 = Color3.fromRGB(161, 68, 177)
  86. end)
  87.  
  88. end)
  89.  
  90. ModWood.Name = "ModWood"
  91. ModWood.Parent = Main
  92. ModWood.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  93. ModWood.BackgroundTransparency = 0.750
  94. ModWood.BorderColor3 = Color3.fromRGB(161, 68, 177)
  95. ModWood.Position = UDim2.new(0.0720449463, 0, 0.334517896, 0)
  96. ModWood.Size = UDim2.new(0, 87, 0, 49)
  97. ModWood.Font = Enum.Font.SourceSans
  98. ModWood.Text = "ModWood"
  99. ModWood.TextColor3 = Color3.fromRGB(161, 68, 177)
  100. ModWood.TextSize = 14.000
  101. ModWood.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  102. ModWood.MouseButton1Down:connect(function()
  103. --Mod Wood
  104.  
  105. ModWood.MouseButton1Click:Connect(function()
  106. for _, Log in pairs(workspace.LogModels:GetChildren()) do
  107. if Log.Name:sub(1, 6) == "Loose_" and Log:findFirstChild("Owner") then
  108. if Log.Owner.Value == game.Players.LocalPlayer then
  109. for i,v in pairs(Log:GetChildren()) do
  110. if v.Name=="WoodSection" then
  111. spawn(function()
  112. for i=1,10 do
  113. wait()
  114. v.CFrame=CFrame.new(Vector3.new(315, -0.296, 85.791))*CFrame.Angles(math.rad(90),0,0)
  115. end
  116. end)
  117. end
  118. end
  119. spawn(function()
  120. for i=1,20 do
  121. wait()
  122. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Log.WoodSection)
  123. game.ReplicatedStorage.Interaction.ClientRequestOwnership:FireServer(Log.WoodSection)
  124. end
  125. end)
  126. end
  127. end
  128. end
  129. wait(2.0)
  130. for _, Log in pairs(game.Workspace.LogModels:GetChildren()) do
  131. if Log.Name:sub(1, 6) == "Loose_" and Log:findFirstChild("Owner") then
  132. if Log.Owner.Value == game.Players.LocalPlayer then
  133. Log:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position)
  134. for i=1,20 do
  135. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Log.WoodSection)
  136. game.ReplicatedStorage.Interaction.ClientRequestOwnership:FireServer(Log.WoodSection)
  137. end
  138. end
  139. end
  140. end
  141. end)
  142.  
  143. end)
  144.  
  145. SellWood.Name = "SellWood"
  146. SellWood.Parent = Main
  147. SellWood.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  148. SellWood.BackgroundTransparency = 0.750
  149. SellWood.BorderColor3 = Color3.fromRGB(161, 68, 177)
  150. SellWood.Position = UDim2.new(0.525826454, 0, 0.334517896, 0)
  151. SellWood.Size = UDim2.new(0, 87, 0, 49)
  152. SellWood.Font = Enum.Font.SourceSans
  153. SellWood.Text = "SellWood"
  154. SellWood.TextColor3 = Color3.fromRGB(161, 68, 177)
  155. SellWood.TextSize = 14.000
  156. SellWood.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  157. SellWood.MouseButton1Down:connect(function()
  158. --Sell Wood
  159.  
  160. SellWood.MouseButton1Down:connect(function()
  161. for _, Log in pairs(workspace.LogModels:GetChildren()) do
  162. if Log.Name:sub(1, 6) == "Loose_" and Log:findFirstChild("Owner") then
  163. if Log.Owner.Value == game.Players.LocalPlayer then
  164. for i,v in pairs(Log:GetChildren()) do
  165. if v.Name=="WoodSection" then
  166. spawn(function()
  167. for i=1,10 do
  168. wait()
  169. v.CFrame=CFrame.new(Vector3.new(315, -0.296, 85.791))*CFrame.Angles(math.rad(90),0,0)
  170. end
  171. end)
  172. end
  173. end
  174. spawn(function()
  175. for i=1,20 do
  176. wait()
  177. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Log)
  178. end
  179. end)
  180. end
  181. end
  182. end
  183. end)
  184.  
  185. end)
  186.  
  187. AxeDupe.Name = "AxeDupe"
  188. AxeDupe.Parent = Main
  189. AxeDupe.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  190. AxeDupe.BackgroundTransparency = 0.750
  191. AxeDupe.BorderColor3 = Color3.fromRGB(161, 68, 177)
  192. AxeDupe.Position = UDim2.new(0.525826454, 0, 0.68465054, 0)
  193. AxeDupe.Size = UDim2.new(0, 87, 0, 49)
  194. AxeDupe.Font = Enum.Font.SourceSans
  195. AxeDupe.Text = "AxeDupe"
  196. AxeDupe.TextColor3 = Color3.fromRGB(161, 68, 177)
  197. AxeDupe.TextSize = 14.000
  198. AxeDupe.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  199. AxeDupe.MouseButton1Down:connect(function()
  200. local BaseC
  201. for i, v in pairs(game.Workspace.Properties:GetChildren()) do
  202. if v.Owner.Value == game.Players.LocalPlayer then
  203. BaseC = v.OriginSquare.CFrame + Vector3.new(0,5,0)
  204. end
  205. end
  206. if BaseC == nil then
  207. BaseC = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame
  208. end
  209. if game:GetService("Players").LocalPlayer.Character:FindFirstChild("Tool", true) then
  210. game:GetService("Players").LocalPlayer.Character.Humanoid:UnequipTools()
  211. wait(0.1)
  212. end
  213. game:GetService('Players').LocalPlayer.Character.Head:Destroy()
  214. wait(0.2)
  215. game:GetService('Players').LocalPlayer.Character:Destroy()
  216. wait(0.9)
  217. for i,v in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren()) do
  218. local A_1 = v
  219. local A_2 = "Drop tool"
  220. local A_3 = BaseC
  221. local Event = game:GetService("ReplicatedStorage").Interaction.ClientInteracted
  222. Event:FireServer(A_1, A_2, A_3)
  223. end
  224. end)
  225.  
  226.  
  227. RemoveTrees.Name = "RemoveTrees"
  228. RemoveTrees.Parent = Main
  229. RemoveTrees.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  230. RemoveTrees.BackgroundTransparency = 0.750
  231. RemoveTrees.BorderColor3 = Color3.fromRGB(161, 68, 177)
  232. RemoveTrees.Position = UDim2.new(0.525826454, 0, 0.512236714, 0)
  233. RemoveTrees.Size = UDim2.new(0, 87, 0, 49)
  234. RemoveTrees.Font = Enum.Font.SourceSans
  235. RemoveTrees.Text = "RemoveTrees"
  236. RemoveTrees.TextColor3 = Color3.fromRGB(161, 68, 177)
  237. RemoveTrees.TextSize = 14.000
  238. RemoveTrees.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  239. RemoveTrees.MouseButton1Down:connect(function()
  240. --RemoveTrees
  241.  
  242. RemoveTrees.MouseButton1Click:Connect(function()
  243. for i,v in pairs(game.Workspace:GetDescendants()) do
  244. if v.Name == "WoodSection" and v.Parent:FindFirstChild("CutEvent") then
  245. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(v.Parent)
  246. game.ReplicatedStorage.Interaction.DestroyStructure:FireServer(v.Parent)
  247. end
  248. end
  249. game.Workspace.DescendantAdded:connect(function(Thing)
  250. wait(0.1)
  251. if Thing.Name == "WoodSection" and Thing.Parent:FindFirstChild("CutEvent") then
  252. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Thing.Parent)
  253. game.ReplicatedStorage.Interaction.DestroyStructure:FireServer(Thing.Parent)
  254. end
  255. end)
  256. end)
  257. end)
  258.  
  259. AntiBLAll.Name = "AntiBLAll"
  260. AntiBLAll.Parent = Main
  261. AntiBLAll.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  262. AntiBLAll.BackgroundTransparency = 0.750
  263. AntiBLAll.BorderColor3 = Color3.fromRGB(161, 68, 177)
  264. AntiBLAll.Position = UDim2.new(0.0720449463, 0, 0.68465054, 0)
  265. AntiBLAll.Size = UDim2.new(0, 87, 0, 49)
  266. AntiBLAll.Font = Enum.Font.SourceSans
  267. AntiBLAll.Text = "AntiBLAll"
  268. AntiBLAll.TextColor3 = Color3.fromRGB(161, 68, 177)
  269. AntiBLAll.TextSize = 14.000
  270. AntiBLAll.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  271. AntiBLAll.MouseButton1Click:Connect(function()
  272. local plr = game.Players.LocalPlayer
  273. local cframe
  274. for i,v in next, workspace:GetDescendants() do
  275. if v:IsA("SpawnLocation") then
  276. v.Touched:Connect(function(h)
  277. if h.Parent == plr.Character and cframe then
  278. plr.Character:SetPrimaryPartCFrame(cframe)
  279. end
  280. end)
  281. end
  282. end
  283.  
  284. game:GetService("RunService"):BindToRenderStep("NO HACKS",Enum.RenderPriority.Last.Value,function()
  285. if game.Players.LocalPlayer.Character.PrimaryPart then
  286. cframe = game.Players.LocalPlayer.Character.PrimaryPart.CFrame
  287. end
  288. end)
  289.  
  290. for i,v in next, debug.getregistry() do
  291. if type(v)=='function' and debug.getupvalues(v).lastUpdate then
  292. debug.setupvalue(v,"lastUpdate",math.huge)
  293. break
  294. end
  295. end
  296.  
  297. for i,v in next, workspace.Effects:GetChildren() do
  298. if v:IsA("BasePart") and v.Name == "BlacklistWall" then
  299. v:Destroy()
  300. end
  301. end
  302. end)
  303.  
  304. TPWood.Name = "TPWood"
  305. TPWood.Parent = Main
  306. TPWood.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  307. TPWood.BackgroundTransparency = 0.750
  308. TPWood.BorderColor3 = Color3.fromRGB(161, 68, 177)
  309. TPWood.Position = UDim2.new(0.0720449388, 0, 0.509584248, 0)
  310. TPWood.Size = UDim2.new(0, 87, 0, 49)
  311. TPWood.Font = Enum.Font.SourceSans
  312. TPWood.Text = "TPWood"
  313. TPWood.TextColor3 = Color3.fromRGB(161, 68, 177)
  314. TPWood.TextSize = 14.000
  315. TPWood.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  316. --TPWood
  317.  
  318. TPWood.MouseButton1Click:Connect(function()
  319. for _, Log in pairs(game.Workspace.LogModels:GetChildren()) do
  320. if Log.Name:sub(1, 6) == "Loose_" and Log:findFirstChild("Owner") then
  321. if Log.Owner.Value == game.Players.LocalPlayer then
  322. Log:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(0, 20, 0))
  323. for i=1,100 do
  324. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Log)
  325. end
  326. end
  327. end
  328. end
  329. end)
  330.  
  331. RooTsV1.Name = "RooTsV1"
  332. RooTsV1.Parent = Main
  333. RooTsV1.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  334. RooTsV1.BorderColor3 = Color3.fromRGB(161, 68, 177)
  335. RooTsV1.Position = UDim2.new(-0.00349922106, 0, -0.00103794038, 0)
  336. RooTsV1.Size = UDim2.new(0, 204, 0, 49)
  337. RooTsV1.Font = Enum.Font.GothamBold
  338. RooTsV1.Text = "RooTsV1"
  339. RooTsV1.TextColor3 = Color3.fromRGB(161, 68, 177)
  340. RooTsV1.TextScaled = true
  341. RooTsV1.TextSize = 14.000
  342. RooTsV1.TextWrapped = true
  343.  
  344. BYJAYZONE.Name = "BY JAYZONE"
  345. BYJAYZONE.Parent = Main
  346. BYJAYZONE.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  347. BYJAYZONE.BorderColor3 = Color3.fromRGB(161, 68, 177)
  348. BYJAYZONE.Position = UDim2.new(-0.00349922106, 0, 0.86673969, 0)
  349. BYJAYZONE.Size = UDim2.new(0, 238, 0, 50)
  350. BYJAYZONE.Font = Enum.Font.GothamBold
  351. BYJAYZONE.Text = "BY JAYZONE#9904"
  352. BYJAYZONE.TextColor3 = Color3.fromRGB(161, 68, 177)
  353. BYJAYZONE.TextScaled = true
  354. BYJAYZONE.TextSize = 14.000
  355. BYJAYZONE.TextWrapped = true
  356.  
  357. Fly.Name = "Fly"
  358. Fly.Parent = Main
  359. Fly.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  360. Fly.BackgroundTransparency = 0.750
  361. Fly.BorderColor3 = Color3.fromRGB(161, 68, 177)
  362. Fly.Position = UDim2.new(0.0720449463, 0, 0.164756626, 0)
  363. Fly.Size = UDim2.new(0, 87, 0, 49)
  364. Fly.Font = Enum.Font.SourceSans
  365. Fly.Text = "Fly"
  366. Fly.TextColor3 = Color3.fromRGB(161, 68, 177)
  367. Fly.TextSize = 14.000
  368. Fly.TextStrokeColor3 = Color3.fromRGB(2161, 68, 177)
  369. --Fly
  370.  
  371. local toggle = false
  372. Fly.MouseButton1Click:Connect(function()
  373. toggle = not toggle
  374. Fly.TextColor3 = (toggle and Color3.fromRGB(161, 68, 177) or Color3.fromRGB(161, 68, 177))
  375. if toggle then
  376. flying = not flying
  377. repeat wait()
  378. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  379. local mouse = game.Players.LocalPlayer:GetMouse()
  380. repeat wait() until mouse
  381. local plr = game.Players.LocalPlayer
  382. local torso = plr.Character.Torso
  383. local deb = true
  384. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  385. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  386. local maxspeed = 200
  387. local speed = 0
  388. if flying then
  389. end
  390.  
  391. function FlyFunction()
  392. local bg = Instance.new("BodyGyro", torso)
  393. bg.P = 9e4
  394. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  395. bg.cframe = torso.CFrame
  396. local bv = Instance.new("BodyVelocity", torso)
  397. bv.velocity = Vector3.new(0,0.1,0)
  398. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  399. repeat wait()
  400. plr.Character.Humanoid.PlatformStand = true
  401. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  402. speed = speed+.5+(speed/maxspeed)
  403. if speed > maxspeed then
  404. speed = maxspeed
  405. end
  406. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  407. speed = speed-1
  408. if speed < 0 then
  409. speed = 0
  410. end
  411. end
  412. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  413. 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
  414. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  415. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  416. 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
  417. else
  418. bv.velocity = Vector3.new(0,0.1,0)
  419. end
  420. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  421. until not flying
  422. ctrl = {f = 0, b = 0, l = 0, r = 0}
  423. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  424. speed = 0
  425. bg:Destroy()
  426. bv:Destroy()
  427. plr.Character.Humanoid.PlatformStand = false
  428. end
  429. mouse.KeyDown:connect(function(key)
  430. if key:lower() == "w" then
  431. ctrl.f = 1
  432. elseif key:lower() == "s" then
  433. ctrl.b = -1
  434. elseif key:lower() == "a" then
  435. ctrl.l = -1
  436. elseif key:lower() == "d" then
  437. ctrl.r = 1
  438.  
  439. end
  440. end)
  441. mouse.KeyUp:connect(function(key)
  442. if key:lower() == "w" then
  443. ctrl.f = 0
  444. elseif key:lower() == "s" then
  445. ctrl.b = 0
  446. elseif key:lower() == "a" then
  447. ctrl.l = 0
  448. elseif key:lower() == "d" then
  449. ctrl.r = 0
  450. end
  451. end)
  452. FlyFunction()
  453. else
  454. flying = not flying
  455. repeat wait()
  456. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  457. local mouse = game.Players.LocalPlayer:GetMouse()
  458. repeat wait() until mouse
  459. local plr = game.Players.LocalPlayer
  460. local torso = plr.Character.Torso
  461. local deb = true
  462. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  463. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  464. local maxspeed = 200
  465. local speed = 0
  466. if flying then
  467. end
  468.  
  469. function FlyFunction()
  470. local bg = Instance.new("BodyGyro", torso)
  471. bg.P = 9e4
  472. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  473. bg.cframe = torso.CFrame
  474. local bv = Instance.new("BodyVelocity", torso)
  475. bv.velocity = Vector3.new(0,0.1,0)
  476. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  477. repeat wait()
  478. plr.Character.Humanoid.PlatformStand = true
  479. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  480. speed = speed+.5+(speed/maxspeed)
  481. if speed > maxspeed then
  482. speed = maxspeed
  483. end
  484. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  485. speed = speed-1
  486. if speed < 0 then
  487. speed = 0
  488. end
  489. end
  490. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  491. 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
  492. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  493. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  494. 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
  495. else
  496. bv.velocity = Vector3.new(0,0.1,0)
  497. end
  498. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  499. until not flying
  500. ctrl = {f = 0, b = 0, l = 0, r = 0}
  501. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  502. speed = 0
  503. bg:Destroy()
  504. bv:Destroy()
  505. plr.Character.Humanoid.PlatformStand = false
  506. end
  507. mouse.KeyDown:connect(function(key)
  508. if key:lower() == "w" then
  509. ctrl.f = 1
  510. elseif key:lower() == "s" then
  511. ctrl.b = -1
  512. elseif key:lower() == "a" then
  513. ctrl.l = -1
  514. elseif key:lower() == "d" then
  515. ctrl.r = 1
  516.  
  517. end
  518. end)
  519. mouse.KeyUp:connect(function(key)
  520. if key:lower() == "w" then
  521. ctrl.f = 0
  522. elseif key:lower() == "s" then
  523. ctrl.b = 0
  524. elseif key:lower() == "a" then
  525. ctrl.l = 0
  526. elseif key:lower() == "d" then
  527. ctrl.r = 0
  528. end
  529. end)
  530. FlyFunction()
  531. end
  532. end)
  533.  
  534. Close.Name = "Close"
  535. Close.Parent = Main
  536. Close.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  537. Close.BorderColor3 = Color3.fromRGB(161, 68, 177)
  538. Close.Position = UDim2.new(0.853643656, 0, 0, 0)
  539. Close.Size = UDim2.new(0, 34, 0, 49)
  540. Close.Font = Enum.Font.Gotham
  541. Close.Text = "X"
  542. Close.TextColor3 = Color3.fromRGB(161, 68, 177)
  543. Close.TextSize = 14.000
  544. Close.MouseButton1Down:connect(function()
  545. OpenFrame.Visible = true
  546. Main.Visible = false
  547. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement