Advertisement
mr2meows

skateboard

Jul 3rd, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.50 KB | None | 0 0
  1. -- Objects To Lua Make By HairBaconGamming --
  2. local Module_Scripts = {}
  3. local OBCSkateboard = Instance.new("Tool")
  4. local Handle = Instance.new("Part")
  5. local Drop = Instance.new("Sound")
  6. local Mesh = Instance.new("SpecialMesh")
  7. local RightGripAttachment = Instance.new("Attachment")
  8. local RemoteControl = Instance.new("Configuration")
  9. local ServerControl = Instance.new("RemoteFunction")
  10. local ClientControl = Instance.new("RemoteFunction")
  11. local LocalScript = Instance.new("LocalScript")
  12. local MouseIcon = Instance.new("LocalScript")
  13. local Script = Instance.new("Script")
  14.  
  15. -- Properties --
  16.  
  17. OBCSkateboard.Grip = CFrame.new(0.600000024, 0.200000003, 0, -0.000408172607, 0.408248276, 0.912870824, -0.894345462, 0.408248276, -0.1829741, -0.447376817, -0.816496551, 0.364948362)
  18. OBCSkateboard.GripForward = Vector3.new(-0.9128708243370056, 0.18297410011291504, -0.3649483621120453)
  19. OBCSkateboard.GripPos = Vector3.new(0.6000000238418579, 0.20000000298023224, 0)
  20. OBCSkateboard.GripRight = Vector3.new(-0.000408172607421875, -0.8943454623222351, -0.4473768174648285)
  21. OBCSkateboard.GripUp = Vector3.new(0.40824827551841736, 0.40824827551841736, -0.8164965510368347)
  22. OBCSkateboard.Name = [[OBCSkateboard]]
  23. OBCSkateboard.Parent = owner.Backpack
  24. OBCSkateboard.TextureId = [[http://www.roblox.com/asset/?id=27901917]]
  25.  
  26. Handle.BottomSurface = Enum.SurfaceType.Smooth
  27. Handle.CFrame = CFrame.new(0, 0, 0, 0.433012664, 0.749999702, 0.499999613, -0.465625077, -0.288848042, 0.836515844, 0.771811247, -0.595034838, 0.224143788)
  28. Handle.Locked = true
  29. Handle.Name = [[Handle]]
  30. Handle.Orientation = Vector3.new(-56.77000045776367, 65.8499984741211, -121.80999755859375)
  31. Handle.Parent = OBCSkateboard
  32. Handle.Rotation = Vector3.new(-75, 30, -60)
  33. Handle.Size = Vector3.new(2, 0.4000000059604645, 6)
  34. Handle.TopSurface = Enum.SurfaceType.Smooth
  35.  
  36. Drop.Name = [[Drop]]
  37. Drop.Parent = Handle
  38. Drop.SoundId = [[http://www.roblox.com/asset/?id=10548108]]
  39. Drop.Volume = 1
  40.  
  41. Mesh.MeshId = [[http://www.roblox.com/asset/?id=25244821]]
  42. Mesh.MeshType = Enum.MeshType.FileMesh
  43. Mesh.Parent = Handle
  44. Mesh.Scale = Vector3.new(1.149999976158142, 1.149999976158142, 1.149999976158142)
  45. Mesh.TextureId = [[http://www.roblox.com/asset/?id=27757736]]
  46.  
  47. RightGripAttachment.Axis = Vector3.new(0, -1, 0)
  48. RightGripAttachment.CFrame = CFrame.new(0, -0.200000003, 0, 0, 1, -0, -1, 0, 0, 0, 0, 1)
  49. RightGripAttachment.Name = [[RightGripAttachment]]
  50. RightGripAttachment.Orientation = Vector3.new(-0, -0, -90)
  51. RightGripAttachment.Parent = Handle
  52. RightGripAttachment.Position = Vector3.new(0, -0.20000000298023224, 0)
  53. RightGripAttachment.Rotation = Vector3.new(-0, -0, -90)
  54. RightGripAttachment.SecondaryAxis = Vector3.new(1, 0, 0)
  55.  
  56. RemoteControl.Name = [[RemoteControl]]
  57. RemoteControl.Parent = OBCSkateboard
  58.  
  59. ServerControl.Name = [[ServerControl]]
  60. ServerControl.Parent = RemoteControl
  61.  
  62. ClientControl.Name = [[ClientControl]]
  63. ClientControl.Parent = RemoteControl
  64.  
  65. function LocalScript_ScriptfakeXD()
  66.  
  67. local script = Instance.new("LocalScript",OBCSkateboard)
  68. LocalScript = script
  69. script.Name = [[LocalScript]]
  70. local require_fake = require
  71. local require = function(Object)
  72. local functiom = Module_Scripts[Object]
  73. if functiom then
  74. return functiom()
  75. end
  76. return require_fake(Object)
  77. end
  78.  
  79. --Made by Luckymaxer
  80.  
  81. Tool = script.Parent
  82. Handle = Tool:WaitForChild("Handle")
  83.  
  84. Players = game:GetService("Players")
  85.  
  86. RemoteControl = Tool:WaitForChild("RemoteControl")
  87.  
  88. ServerControl = RemoteControl:WaitForChild("ServerControl")
  89. ClientControl = RemoteControl:WaitForChild("ClientControl")
  90.  
  91. ToolEquipped = false
  92. MouseControls = {}
  93.  
  94. ClientControl.OnClientInvoke = (function(Mode, Value)
  95. if Mode == "PlaySound" and Value then
  96. Value:Play()
  97. elseif Mode == "PlaySound" and Value then
  98. Value:Play()
  99. elseif Mode == "MousePosition" then
  100. return PlayerMouse.Hit.p
  101. end
  102. end)
  103.  
  104. function InvokeServer(Mode, Value)
  105. local ServerReturn = nil
  106. pcall(function()
  107. ServerReturn = ServerControl:InvokeServer(Mode, Value)
  108. end)
  109. return ServerReturn
  110. end
  111.  
  112. function CheckIfAlive()
  113. return (((Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
  114. end
  115.  
  116. function Equipped(Mouse)
  117. Character = Tool.Parent
  118. Player = Players:GetPlayerFromCharacter(Character)
  119. Humanoid = Character:FindFirstChild("Humanoid")
  120. ToolEquipped = true
  121. if not CheckIfAlive() then
  122. return
  123. end
  124. PlayerMouse = Mouse
  125. for i, v in pairs(MouseControls) do
  126. if v then
  127. v:disconnect()
  128. end
  129. end
  130. MouseControls = {}
  131. MouseDown = PlayerMouse.Button1Down:connect(function()
  132. InvokeServer("MouseClick", {Down = true})
  133. end)
  134. MouseUp = PlayerMouse.Button1Up:connect(function()
  135. InvokeServer("MouseClick", {Down = false})
  136. end)
  137. end
  138.  
  139. function Unequipped()
  140. ToolEquipped = false
  141. for i, v in pairs(MouseControls) do
  142. if v then
  143. v:disconnect()
  144. end
  145. end
  146. MouseControls = {}
  147. end
  148.  
  149. Tool.Equipped:connect(Equipped)
  150. Tool.Unequipped:connect(Unequipped)
  151.  
  152. end
  153. coroutine.wrap(LocalScript_ScriptfakeXD)()
  154.  
  155.  
  156. function MouseIcon_ScriptfakeXD()
  157.  
  158. local script = Instance.new("LocalScript",OBCSkateboard)
  159. MouseIcon = script
  160. script.Name = [[MouseIcon]]
  161. local require_fake = require
  162. local require = function(Object)
  163. local functiom = Module_Scripts[Object]
  164. if functiom then
  165. return functiom()
  166. end
  167. return require_fake(Object)
  168. end
  169.  
  170. --Made by Luckymaxer
  171.  
  172. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  173. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  174.  
  175. Tool = script.Parent
  176.  
  177. Mouse = nil
  178.  
  179. function UpdateIcon()
  180. if Mouse then
  181. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  182. end
  183. end
  184.  
  185. function OnEquipped(ToolMouse)
  186. Mouse = ToolMouse
  187. UpdateIcon()
  188. end
  189.  
  190. function OnChanged(Property)
  191. if Property == "Enabled" then
  192. UpdateIcon()
  193. end
  194. end
  195.  
  196. Tool.Equipped:connect(OnEquipped)
  197. Tool.Changed:connect(OnChanged)
  198.  
  199. end
  200. coroutine.wrap(MouseIcon_ScriptfakeXD)()
  201.  
  202.  
  203. function Script_ScriptfakeXD()
  204.  
  205. local script = Instance.new("Script",OBCSkateboard)
  206. Script = script
  207. script.Name = [[Script]]
  208. local require_fake = require
  209. local require = function(Object)
  210. local functiom = Module_Scripts[Object]
  211. if functiom then
  212. return functiom()
  213. end
  214. return require_fake(Object)
  215. end
  216.  
  217. --Made by Luckymaxer
  218.  
  219. Tool = script.Parent
  220. Handle = Tool:WaitForChild("Handle")
  221. Mesh = Handle:WaitForChild("Mesh")
  222.  
  223. Players = game:GetService("Players")
  224. Debris = game:GetService("Debris")
  225.  
  226. RemoteControl = Tool:WaitForChild("RemoteControl")
  227.  
  228. ServerControl = (RemoteControl:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  229. ServerControl.Name = "ServerControl"
  230. ServerControl.Parent = RemoteControl
  231.  
  232. ClientControl = (RemoteControl:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  233. ClientControl.Name = "ClientControl"
  234. ClientControl.Parent = RemoteControl
  235.  
  236. SkateboardModule = require(199238756)
  237. SkateboardFunctions = SkateboardModule.SkateboardFunctions
  238. Functions = SkateboardModule.Functions
  239.  
  240. Skateboard = SkateboardFunctions.GetSkateboard("Classic")
  241. SkateboardFunctions.CreateConfiguration(Tool, Skateboard)
  242. SkateboardPlatform = SkateboardFunctions.GetSkateboardPlatform(Skateboard)
  243.  
  244. Sounds = {
  245. Drop = Handle:WaitForChild("Drop")
  246. }
  247.  
  248. ToolEquipped = false
  249. ToolEnabled = true
  250.  
  251. Tool.Enabled = true
  252.  
  253. ServerControl.OnServerInvoke = (function(player, Mode, Value)
  254. end)
  255.  
  256. function InvokeClient(Mode, Value)
  257. local ClientReturn = nil
  258. pcall(function()
  259. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  260. end)
  261. return ClientReturn
  262. end
  263.  
  264. function DropSkateboard()
  265.  
  266. local MousePosition = InvokeClient("MousePosition")
  267.  
  268. local DesiredAngle = (math.acos((MousePosition - Handle.Position).unit:Dot(Torso.CFrame.lookVector)))
  269. if DesiredAngle > (math.pi / 2) then --Prevents spawning behind character.
  270. --return
  271. end
  272.  
  273. local SkateboardSize = Skateboard:GetModelSize()
  274.  
  275. local Direction = CFrame.new(Torso.Position, Vector3.new(MousePosition.X, Torso.Position.Y, MousePosition.Z))
  276. local SkateboardCFrame = Direction + Direction.lookVector * (((Torso.Size.Z / 2) + (SkateboardSize.Z / 2)) * 1.5)
  277. local SkateboardAngle = CFrame.Angles(0, 0, 0)
  278.  
  279. local RayOffset = Vector3.new(-1.5, 0, -1.5)
  280.  
  281. local RayPoints = { --Border points and center of skateboard used for casting rays.
  282. Center = Functions.PositionPart(SkateboardCFrame, 0, 0, 0),
  283. BackLeft = Functions.PositionPart(SkateboardCFrame, -((SkateboardSize.X / 2) + RayOffset.X), RayOffset.Y, -((SkateboardSize.Z / 2) + RayOffset.Z)),
  284. BackRight = Functions.PositionPart(SkateboardCFrame, ((SkateboardSize.X / 2) + RayOffset.X), RayOffset.Y, -((SkateboardSize.Z / 2) + RayOffset.Z)),
  285. FrontLeft = Functions.PositionPart(SkateboardCFrame, -((SkateboardSize.X / 2) + RayOffset.X), RayOffset.Y, ((SkateboardSize.Z / 2) + RayOffset.Z)),
  286. FrontRight = Functions.PositionPart(SkateboardCFrame, ((SkateboardSize.X / 2) + RayOffset.X), RayOffset.Y, ((SkateboardSize.Z / 2) + RayOffset.Z)),
  287. }
  288.  
  289. local RayData = {
  290. Area = { --Cast ray to determine if skateboard will spawn inside something.
  291. Offset = Vector3.new(0, (SkateboardSize.Y / 2), 0),
  292. Direction = Vector3.new(0, 1, 0),
  293. Distance = SkateboardSize.Y
  294. },
  295. Ground = { --Cast ray to determine if the skateboard can spawn on the ground.
  296. Direction = Vector3.new(0, -1, 0),
  297. Distance = (SkateboardSize.Y * 4)
  298. }
  299. }
  300.  
  301. local Ignore = {Character, Skateboard}
  302.  
  303. local HighestGroundRayHit, HighestGroundRayPos --Get the highest point of elevation to spawn the skateboard.
  304. for i, v in pairs(RayPoints) do
  305. local GroundRayHit, GroundRayPos = Functions.RayCast(v.p, RayData.Ground.Direction, RayData.Ground.Distance, Ignore)
  306. if not HighestGroundRayPos or GroundRayPos.Y > HighestGroundRayPos.Y then
  307. HighestGroundRayHit, HighestGroundRayPos = GroundRayHit, GroundRayPos
  308. end
  309. end
  310.  
  311. local FullAreaIsEmpty = true --Ensure entire area is empty.
  312. for i, v in pairs(RayPoints) do
  313. local AreaIsEmpty = Functions.RegionEmpty((v.p - RayData.Area.Offset), {Min = Vector3.new(0, 0, 0), Max = (RayData.Area.Direction * RayData.Area.Distance)}, Ignore)
  314. if not AreaIsEmpty then
  315. FullAreaIsEmpty = false
  316. end
  317. end
  318.  
  319. if not FullAreaIsEmpty or not HighestGroundRayHit then
  320. return
  321. end
  322.  
  323. ToolEnabled = false
  324.  
  325. local PosX, PosY, PosZ, R00, R01, R02, R10, R11, R12, R20, R21, R22 = SkateboardCFrame:components()
  326. SkateboardCFrame = CFrame.new(PosX, (HighestGroundRayPos.Y + (SkateboardSize.Y / 2)), PosZ, R00, R01, R02, R10, R11, R12, R20, R21, R22)
  327.  
  328. InvokeClient("PlaySound", Sounds.Drop)
  329.  
  330. Tool.Parent = nil
  331.  
  332. SkateboardFunctions.SpawnSkateboard(Skateboard, (SkateboardCFrame * SkateboardAngle))
  333.  
  334. Debris:AddItem(Tool, 0)
  335. Tool:Destroy()
  336.  
  337. end
  338.  
  339. function CheckIfAlive()
  340. return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
  341. end
  342.  
  343. function Activated()
  344. if not ToolEquipped or not ToolEnabled or not CheckIfAlive() then
  345. return
  346. end
  347. DropSkateboard()
  348. end
  349.  
  350. function Equipped()
  351. Character = Tool.Parent
  352. Player = Players:GetPlayerFromCharacter(Character)
  353. Humanoid = Character:FindFirstChild("Humanoid")
  354. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild('UpperTorso')
  355. if not CheckIfAlive() then
  356. return
  357. end
  358. ToolEquipped = true
  359. end
  360.  
  361. function Unequipped()
  362. ToolEquipped = false
  363. end
  364.  
  365. Tool.Activated:connect(Activated)
  366. Tool.Equipped:connect(Equipped)
  367. Tool.Unequipped:connect(Unequipped)
  368.  
  369. end
  370. coroutine.wrap(Script_ScriptfakeXD)()
  371.  
  372.  
  373. -- End --
  374. -- Thank for using --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement