Advertisement
lafur

Untitled

Aug 31st, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.00 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end Plrs = game:GetService("Players")
  6. me = Plrs.LocalPlayer
  7. char = me.Character
  8. Modelname = "xBananaz"
  9. Toolname = "Banana"
  10. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  11. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  12. selected = false
  13. Able = true
  14. Prop = {Damage = 30}
  15.  
  16. ToolIcon = ""
  17. MouseIc = ""
  18. MouseDo = ""
  19.  
  20. function Notime(func, tim)
  21. coroutine.resume(coroutine.create(function()
  22. if tim then
  23. wait(tim)
  24. end
  25. func()
  26. end))
  27. end
  28.  
  29. Add = {
  30. Sphere = function(P)
  31. local m = Instance.new("SpecialMesh",P)
  32. m.MeshType = "Sphere"
  33. return m
  34. end,
  35. BF = function(P)
  36. local bf = Instance.new("BodyForce",P)
  37. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  38. return bf
  39. end,
  40. BP = function(P)
  41. local bp = Instance.new("BodyPosition",P)
  42. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  43. bp.P = 14000
  44. return bp
  45. end,
  46. BG = function(P)
  47. local bg = Instance.new("BodyGyro",P)
  48. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  49. bg.P = 14000
  50. return bg
  51. end,
  52. Mesh = function(P, ID, x, y, z)
  53. local m = Instance.new("SpecialMesh")
  54. m.MeshId = ID
  55. m.Scale = Vector3.new(x, y, z)
  56. m.Parent = P
  57. return m
  58. end,
  59. Sound = function(P, ID, vol, pitch)
  60. local s = Instance.new("Sound")
  61. s.SoundId = ID
  62. s.Volume = vol
  63. s.Pitch = pitch
  64. s.Parent = P
  65. return s
  66. end
  67. }
  68.  
  69. function find(tab, arg)
  70. local ah = nil
  71. for i,v in pairs(tab) do
  72. if v == arg then
  73. ah = v
  74. end
  75. end
  76. return ah
  77. end
  78.  
  79. function getAllParts(from)
  80. local t = {}
  81. function getParts(where)
  82. for i, v in pairs(where:children()) do
  83. if v:IsA("BasePart") then
  84. if v.Parent ~= char and v.Parent.Parent ~= char then
  85. table.insert(t, v)
  86. end
  87. end
  88. getParts(v)
  89. end
  90. end
  91. getParts(workspace)
  92. return t
  93. end
  94.  
  95. function RayCast(pos1, pos2, maxDist, forward)
  96. local list = getAllParts(workspace)
  97. local pos0 = pos1
  98. for dist = 1, maxDist, forward do
  99. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  100. for _, v in pairs(list) do
  101. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  102. local s = v.Size
  103. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
  104. return pos0, v
  105. end
  106. end
  107. end
  108. return pos0, nil
  109. end
  110.  
  111. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  112. local p = Instance.new("Part")
  113. p.formFactor = "Custom"
  114. p.Anchored = Anchor
  115. p.CanCollide = Collide
  116. p.Transparency = Tran
  117. p.Reflectance = Ref
  118. p.BrickColor = BrickColor.new(Color)
  119. for _, Surf in pairs(Surfaces) do
  120. p[Surf] = "Smooth"
  121. end
  122. p.Size = Vector3.new(X, Y, Z)
  123. if Break then
  124. p:BreakJoints()
  125. else p:MakeJoints() end
  126. p.Parent = Parent
  127. return p
  128. end
  129.  
  130. function Weld(p0, p1, x, y, z, a, b, c)
  131. local w = Instance.new("Weld")
  132. w.Parent = p0
  133. w.Part0 = p0
  134. w.Part1 = p1
  135. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  136. return w
  137. end
  138.  
  139. function ComputePos(pos1, pos2)
  140. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  141. return CFrame.new(pos1, pos3)
  142. end
  143.  
  144. function getHumanoid(c)
  145. local h = nil
  146. for i,v in pairs(c:children()) do
  147. if v:IsA("Humanoid") then
  148. if v.Health > 0 then
  149. h = v
  150. end
  151. end
  152. end
  153. return h
  154. end
  155.  
  156. for i,v in pairs(char:children()) do
  157. if v.Name == Modelname then
  158. v:remove()
  159. end
  160. end
  161.  
  162. torso = char.Torso
  163. neck = torso.Neck
  164. hum = char.Humanoid
  165. Rarm = char["Right Arm"]
  166. Larm = char["Left Arm"]
  167. Rleg = char["Right Leg"]
  168. Lleg = char["Left Leg"]
  169.  
  170. hc = Instance.new("Humanoid")
  171. hc.Health = 0
  172. hc.MaxHealth = 0
  173.  
  174. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
  175. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  176. charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
  177. boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
  178. smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
  179. boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
  180.  
  181. function PlaySound(sound, pitch, vol)
  182. local s = sound:clone()
  183. if pitch ~= nil then
  184. if tonumber(pitch) then
  185. s.Pitch = tonumber(pitch)
  186. end
  187. end
  188. if vol ~= nil then
  189. if tonumber(vol) then
  190. s.Volume = tonumber(vol)
  191. end
  192. end
  193. s.Parent = torso
  194. s.PlayOnRemove = true
  195. coroutine.resume(coroutine.create(function()
  196. wait()
  197. s:remove()
  198. end))
  199. end
  200.  
  201. Mo = Instance.new("Model")
  202. Mo.Name = Modelname
  203.  
  204. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  205. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  206. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  207. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  208.  
  209. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  210. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  211. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  212. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  213.  
  214. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  215. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  216. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  217. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  218.  
  219. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  220. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  221. HW = Weld(HB, nil, 0, 0.3, 0, math.pi/2, math.pi, 0)
  222.  
  223. Mo.Parent = char
  224.  
  225. function MakeBanana()
  226. local Banana = Part(workspace, false, true, 0, 0, "Bright yellow", 0.9, 0.95, 0.9, true)
  227. Banana.Friction = 0.8
  228. Banana.Elasticity = 0
  229. local mes = Add.Mesh(Banana, "http://www.roblox.com/asset/?id=28937301", 1.3, 0.8, 1.3)
  230. mes.TextureId = "http://www.roblox.com/asset/?id=28937670"
  231. HW.Part1 = Banana
  232. return Banana
  233. end
  234.  
  235. if script.Parent.className ~= "HopperBin" then
  236. h = Instance.new("HopperBin",me.Backpack)
  237. h.Name = Toolname
  238. h.TextureId = ToolIcon
  239. script.Parent = h
  240. end
  241.  
  242. bin = script.Parent
  243.  
  244. function detach(bool)
  245. LLW.C0 = CFrame.new(0, 0, 0)
  246. RLW.C0 = CFrame.new(0, 0, 0)
  247. LAW.C0 = CFrame.new(0,0,0)
  248. RAW.C0 = CFrame.new(0, 0, 0)
  249. if bool then
  250. LLW.Part1 = nil
  251. RLW.Part1 = nil
  252. RAW.Part1 = nil
  253. LAW.Part1 = nil
  254. end
  255. end
  256.  
  257. function attach()
  258. RAW.Part1 = Rarm
  259. LAW.Part1 = Larm
  260. RLW.Part1 = Rleg
  261. LLW.Part1 = Lleg
  262. end
  263.  
  264. function normal()
  265. neck.C0 = NeckStand
  266. RAW.C0 = RAWStand
  267. LAW.C0 = LAWStand
  268. RLW.C0 = RLWStand
  269. LLW.C0 = LLWStand
  270. RAW.C1 = CFrame.new(0, 0.5, 0)
  271. LAW.C1 = CFrame.new(0, 0.5, 0)
  272. RLW.C1 = CFrame.new(0, 0.8, 0)
  273. LLW.C1 = CFrame.new(0, 0.8, 0)
  274. HW.C0 = HWStand
  275. end
  276.  
  277. function throw(mousepos)
  278. RAW.Part1 = Rarm
  279. for i = 0, 1, 0.2 do
  280. RAW.C0 = CFrame.Angles(math.rad(-5*i), 0, math.rad(-15*i)) * CFrame.new(0, -0.2*i, -0.5*i)
  281. wait()
  282. end
  283. local banana = MakeBanana()
  284. for i = 0, 1, 0.14 do
  285. RAW.C0 = CFrame.Angles(math.rad(-5+185*i), 0, math.rad(-15+35*i)) * CFrame.new(0, -0.2+0.1*i, -0.5+0.8*i)
  286. wait()
  287. end
  288. for i = 0, 1, 0.25 do
  289. RAW.C0 = CFrame.Angles(math.rad(-5+185-90*i), 0, math.rad(-15+35-45*i)) * CFrame.new(0, -0.2+0.1-0.4*i, -0.5+0.8-0.3*i)
  290. wait()
  291. end
  292. local pos = CFrame.new(banana.Position, mousepos) * CFrame.Angles(math.rad(25),0,0)
  293. local mag = (torso.Position - mousepos).magnitude
  294. mag = mag - (mag/5)
  295. if mag > 25 then mag = 25 end
  296. local kert = (40+(mag*2))
  297. Notime(function()
  298. HW.Part1 = nil
  299. wait()
  300. banana.Velocity = pos.lookVector * kert
  301. local bg = Add.BG(banana)
  302. bg.P = 4500
  303. bg.maxTorque = Vector3.new(math.huge, 0, math.huge)
  304. wait(0.5)
  305. repeat wait() until banana.Velocity.magnitude < 13
  306. local ablez = true
  307. local con = banana.Touched:connect(function(hit)
  308. local hu = getHumanoid(hit.Parent)
  309. if hu then
  310. local to = hu.Parent:findFirstChild("Torso")
  311. if to and ablez then
  312. ablez = false
  313. local bg = Add.BG(to)
  314. hu.PlatformStand = true
  315. local cf1 = to.CFrame
  316. local cf2 = CFrame.new(cf1.p, (cf1 * CFrame.new(0, 0, -2).p))
  317. to.Velocity = to.Velocity + (cf1.lookVector * -15) + Vector3.new(0, 35, 0)
  318. local ah = math.random(260,280)
  319. local mm = math.random(5,8)/100
  320. Notime(function()
  321. wait(0.25)
  322. ablez = true
  323. end)
  324. banana.Velocity = cf1.lookVector * 35
  325. for i = 0, 1, mm do
  326. bg.cframe = cf2 * CFrame.Angles(math.rad(ah*i), 0, 0)
  327. wait()
  328. end
  329. wait()
  330. bg:remove()
  331. wait(0.4)
  332. hu.PlatformStand = false
  333. end
  334. end
  335. end)
  336. wait(math.random(18,22))
  337. con:disconnect()
  338. for i = 0, 1, 0.033 do
  339. banana.Transparency = i
  340. wait()
  341. end
  342. banana:remove()
  343. end)
  344. for i = 0, 1, 0.16 do
  345. RAW.C0 = CFrame.Angles(math.rad(-5+185-90-90*i), 0, math.rad(-15+35-45+25*i)) * CFrame.new(0, -0.2+0.1-0.4+0.5*i, 0)
  346. wait()
  347. end
  348. detach(true)
  349. end
  350.  
  351. function select(mouse)
  352. selected = true
  353. mouse.Button1Down:connect(function()
  354. if Able then
  355. Able = false
  356. throw(mouse.Hit.p)
  357. wait(0.5)
  358. Able = true
  359. end
  360. end)
  361. end
  362.  
  363. function deselect(mouse)
  364. selected = false
  365. end
  366.  
  367. bin.Selected:connect(select)
  368. bin.Deselected:connect(deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement