Advertisement
rewfsdg3

Untitled

Nov 11th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.91 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,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code by Mokiros")
  7. local rp = RealPlayer
  8. script.Parent = rp.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent then
  34. for _,f in pairs(t.Functions) do
  35. f(...)
  36. end
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=rp then return end
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. if not io.isMouse then
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  52. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  53. end
  54. for _,t in pairs(CAS.Actions) do
  55. for _,k in pairs(t.Keys) do
  56. if k==io.KeyCode then
  57. t.Function(t.Name,io.UserInputState,io)
  58. end
  59. end
  60. end
  61. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  62. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  63. end
  64. end)
  65. Event.Parent = NLS([==[
  66. local Player = game:GetService("Players").LocalPlayer
  67. local Event = script:WaitForChild("UserInput_Event")
  68.  
  69. local Mouse = Player:GetMouse()
  70. local UIS = game:GetService("UserInputService")
  71. local input = function(io,a)
  72. if a then return end
  73. --Since InputObject is a client-side instance, we create and pass table instead
  74. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  75. end
  76. UIS.InputBegan:Connect(input)
  77. UIS.InputEnded:Connect(input)
  78.  
  79. local h,t
  80. --Give the server mouse data 30 times every second, but only if the values changed
  81. --If player is not moving their mouse, client won't fire events
  82. while wait(1/30) do
  83. if h~=Mouse.Hit or t~=Mouse.Target then
  84. h,t=Mouse.Hit,Mouse.Target
  85. Event:FireServer({isMouse=true,Target=t,Hit=h})
  86. end
  87. end]==],Player.Character)
  88.  
  89. ----Sandboxed game object that allows the usage of client-side methods and services
  90. --Real game object
  91. local _rg = game
  92.  
  93. --Metatable for fake service
  94. local fsmt = {
  95. __index = function(self,k)
  96. local s = rawget(self,"_RealService")
  97. if s then
  98. return typeof(s[k])=="function"
  99. and function(_,...)return s[k](s,...)end or s[k]
  100. end
  101. end,
  102. __newindex = function(self,k,v)
  103. local s = rawget(self,"_RealService")
  104. if s then s[k]=v end
  105. end
  106. }
  107. local function FakeService(t,RealService)
  108. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  109. return setmetatable(t,fsmt)
  110. end
  111.  
  112. --Fake game object
  113. local g = {
  114. GetService = function(self,s)
  115. return rawget(self,s) or _rg:GetService(s)
  116. end,
  117. Players = FakeService({
  118. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  119. },"Players"),
  120. UserInputService = FakeService(UIS,"UserInputService"),
  121. ContextActionService = FakeService(CAS,"ContextActionService"),
  122. RunService = FakeService({
  123. _btrs = {},
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126. self._btrs[name] = self.Heartbeat:Connect(fun)
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132. }
  133. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  134. g.service = g.GetService
  135. FakeService(g,game)
  136. --Changing owner to fake player object to support owner:GetMouse()
  137. game,owner = g,g.Players.LocalPlayer
  138. end
  139.  
  140.  
  141. local name = owner.Name --add your name here,click "Q" to swing it
  142.  
  143. local ld = game.Players[name].Character:findFirstChild("Axe")
  144. if ld then
  145. ld:remove()
  146. end
  147.  
  148. local me = game.Players[name]
  149.  
  150. pcall(function() me.Character:findFirstChild("Axe",true).Parent = nil end)
  151.  
  152.  
  153. axe = Instance.new("Model")
  154. axe.Parent = me.Character
  155. axe.Name = "Axe"
  156.  
  157. -------Arm connects------------------------------------------------------
  158.  
  159. brick1 = Instance.new("Part")
  160. brick1.Parent = axe
  161. brick1.Shape = "Ball"
  162. brick1.Size = Vector3.new(1,1,1)
  163. brick1.Transparency = 1
  164. mesh1 = Instance.new("SpecialMesh")
  165. mesh1.Parent = brick1
  166. mesh1.MeshType = "Sphere"
  167. mesh1.Scale = Vector3.new(1.3,1.3,1.3)
  168. brick2 = brick1:clone()
  169. brick2.Parent = axe
  170.  
  171. torsohold1 = Instance.new("Weld")
  172. torsohold1.Parent = me.Character.Torso
  173. torsohold1.Part0 = torsohold1.Parent
  174. torsohold1.Part1 = brick1
  175. torsohold1.C1 = CFrame.new(-1.5,-0.5,0)
  176.  
  177. torsohold2 = Instance.new("Weld")
  178. torsohold2.Parent = me.Character.Torso
  179. torsohold2.Part0 = torsohold2.Parent
  180. torsohold2.Part1 = brick2
  181. torsohold2.C1 = CFrame.new(1.5,-0.5,0)
  182.  
  183. rightoriginal = CFrame.fromEulerAnglesXYZ(-1.1,-0.7,-0.7) * CFrame.new(0.3,0.6,0.2)
  184. leftoriginal = CFrame.fromEulerAnglesXYZ(-1,0.6,0) * CFrame.new(-0.6,0.3,0.5)
  185.  
  186. rarm = me.Character["Right Arm"]
  187. larm = me.Character["Left Arm"]
  188.  
  189. rw = Instance.new("Weld")
  190. rw.Parent = brick1
  191. rw.Part0 = nil
  192. rw.Part1 = nil
  193. rw.C1 = rightoriginal
  194.  
  195. lw = Instance.new("Weld")
  196. lw.Parent = brick2
  197. lw.Part0 = nil
  198. lw.Part1 = nil
  199. lw.C1 = leftoriginal
  200.  
  201. wephold = Instance.new("Weld")
  202. wephold.Parent = me.Character.Torso
  203. wephold.Part0 = wephold.Parent
  204. wephold.Part1 = nil
  205. wephold.C1 = CFrame.new(0,0,-0.6) * CFrame.fromEulerAnglesXYZ(0,0,-2.5)
  206.  
  207. --Handles------------------------------------------------------------------------
  208.  
  209. function property(part, number, color)
  210. part.Parent = axe
  211. part.formFactor = 0
  212. part.TopSurface = 0
  213. part.BottomSurface = 0
  214. part.Name = "Handle"..number
  215. part.Size = Vector3.new(1,1,1)
  216. part.BrickColor = BrickColor.new(color)
  217. part.CanCollide = false
  218. end
  219.  
  220. function mesh(part, mesh, x, y, z)
  221. mesh.Scale = Vector3.new(x,y,z)
  222. mesh.Parent = part
  223. end
  224.  
  225. function weld(weld, part, part1, a, b, c, x, y, z)
  226. weld.Parent = part
  227. weld.Part0 = weld.Parent
  228. weld.Part1 = part1
  229. weld.C1 = CFrame.fromEulerAnglesXYZ(x,y,z) * CFrame.new(a,b,c)
  230. end
  231.  
  232. mainhandle = Instance.new("Part")
  233. property(mainhandle, 1, "Brown")
  234. mainhandle.Size = Vector3.new(1,4,1)
  235.  
  236. mesha = Instance.new("SpecialMesh")
  237. mesha.MeshType = "Head"
  238. mesh(mainhandle, mesha, 0.4, 1, 0.4)
  239.  
  240. wephold.Part1 = mainhandle
  241.  
  242. handlea = Instance.new("Part")
  243. property(handlea, 2, "Dark metallic")
  244. meshb = Instance.new("CylinderMesh")
  245. mesh(handlea, meshb, 0.85, 0.16, 0.85)
  246.  
  247. troll = {}
  248.  
  249. for i=-0.5, 0.6, 0.47 do
  250. handleb = Instance.new("Part")
  251. property(handleb, 3, "Dark grey metallic")
  252. handleb.Size = Vector3.new(2,1,1)
  253. handleb.CanCollide = true
  254. meshc = Instance.new("SpecialMesh")
  255. meshc.MeshType = "Brick"
  256. mesh(handleb, meshc, 1.5, 0.13, 0.8)
  257. waldy = Instance.new("Weld")
  258. weld(waldy, handlea, handleb, 0, 0, 0, 0, i, 0)
  259. table.insert(troll,handleb)
  260. end
  261.  
  262. handlec = Instance.new("Part")
  263. property(handlec, 4, "Dark metallic")
  264. meshd = Instance.new("SpecialMesh")
  265. mesh(handlec, meshd, 0.52,0.9,0.52)
  266.  
  267. --arm weapon weld-----------------------------------
  268.  
  269. armweld = Instance.new("Weld")
  270. weld(armweld, rarm, nil, 0, 1.1, 1.2, 1.57, 0, 2)
  271.  
  272. --Handle welds--------------------------------------
  273.  
  274. hweld1 = Instance.new("Weld")
  275. weld(hweld1, mainhandle, handlea, 0, -1.35, 0, 1.57, 0, 0)
  276.  
  277. hweld2 = Instance.new("Weld")
  278. weld(hweld2, handlea, handlec, 0, 0, 0, 1.57, 0, 0)
  279.  
  280. --blood effect------------------------------
  281.  
  282. function blood(part)
  283. for i=1, 4 do
  284. local b = Instance.new("Part")
  285. b.Parent = workspace
  286. b.formFactor = "Plate"
  287. b.Size = Vector3.new(1,0.4,1)
  288. b.BrickColor = BrickColor.new(21)
  289. b.TopSurface = 0
  290. b.BottomSurface = 0
  291. b.CanCollide = false
  292. b.Velocity = Vector3.new(math.random(-20,20),math.random(0,40),math.random(-20,20))
  293. b.RotVelocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20))
  294. local m = Instance.new("SpecialMesh")
  295. m.MeshType = "Brick"
  296. m.Parent = b
  297. m.Scale = Vector3.new(0.5,0.4,0.5)
  298. b.CFrame = CFrame.new(part.Position)
  299. b.Anchored = false
  300. b:breakJoints()
  301. coroutine.resume(coroutine.create(function()
  302. wait(3)
  303. b:remove()
  304. end))
  305. end
  306. end
  307.  
  308. sele = false
  309. --KILL FUNCTION-------------------------------------------
  310.  
  311. hitting = false
  312. swinging = false
  313.  
  314. troll[2].Touched:connect(function(hit)
  315. if hitting == false then return end
  316. local hu = hit.Parent:findFirstChild("Humanoid")
  317. if hu ~= nil then
  318. hu.Health = hu.Health - 10
  319. blood(hit)
  320. end
  321. end)
  322.  
  323. function att2(r,l,wp)
  324. swinging = true
  325. for i=1, 6 do
  326. r.C0 = r.C0 * CFrame.fromEulerAnglesXYZ(0.15,-0.3,-0.05)
  327. l.C0 = l.C0 * CFrame.fromEulerAnglesXYZ(0.3,-0.2,0)
  328. wp.C0 = wp.C0 * CFrame.fromEulerAnglesXYZ(0.2,0,0)
  329. wait(0.1)
  330. end
  331. r.C0 = CFrame.new(0,0,0)
  332. l.C0 = CFrame.new(0,0,0)
  333. wp.C0 = CFrame.new(0,0,0)
  334. swinging = false
  335. end
  336.  
  337. colors = {"Black", "Bright blue", "Light blue", "Navy blue", "Deep blue", "White"}
  338. numba = #colors
  339.  
  340. if script.Parent.className ~= "HopperBin" then
  341. h = Instance.new("HopperBin")
  342. h.Parent = game.Players[name].Backpack
  343. h.Name = "Ax"
  344. script.Parent = h
  345. end
  346.  
  347. bin = script.Parent
  348.  
  349. function selected(mouse)
  350. sele = true
  351. coroutine.resume(coroutine.create(function()
  352. while sele == true do
  353. wait()
  354. local koko = math.random(-400.0,400.0)/1000
  355. local kokoe = math.random(-400.0,400.0)/1000
  356. local kokoq = math.random(-400.0,400.0)/1000
  357. local k = Instance.new("Part")
  358. k.Parent = workspace
  359. k.formFactor = "Plate"
  360. k.Size = Vector3.new(1,0.4,1)
  361. k.TopSurface = 0
  362. k.BottomSurface = 0
  363. k.Transparency = 0.4
  364. k.Anchored = true
  365. k.CanCollide = false
  366. k.CFrame = handlea.CFrame * CFrame.new(kokoe,kokoq,koko)
  367. k.CFrame = k.CFrame * CFrame.Angles(math.random(-32,32)/10,math.random(-32,32)/10,math.random(-32,32)/10)
  368. k.BrickColor = BrickColor.new(colors[math.random(1,numba)])
  369. local po = Instance.new("SpecialMesh")
  370. po.Parent = k
  371. po.MeshType = "Sphere"
  372. local okok = math.random(15,40)/100
  373. po.Scale = Vector3.new(okok*1.2,okok*0.9,okok*1.1)
  374. coroutine.resume(coroutine.create(function()
  375. for i=1, 12 do
  376. wait()
  377. k.Transparency = k.Transparency + 0.05
  378. end
  379. k:remove()
  380. end))
  381. end
  382. end))
  383. rw.Part0 = rw.Parent
  384. rw.Part1 = rarm
  385. for i=1, 6 do
  386. wait(0.03)
  387. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.4,0,0.1)
  388. end
  389. for i=1, 6 do
  390. wait(0.03)
  391. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.12,0.1,-0.24)
  392. end
  393. armweld.Part1 = mainhandle
  394. wephold.Part0 = nil
  395. wephold.Part1 = nil
  396. wait(0.05)
  397. for i=1, 7 do
  398. wait(0.03)
  399. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.3,0.25,0.1)
  400. end
  401. lw.Part0 = lw.Parent
  402. lw.Part1 = larm
  403. rw.C0 = CFrame.new(0,0,0)
  404. mouse.KeyDown:connect(function(key)
  405. if swinging then return end
  406. key = key:lower()
  407. if (key == "q") then
  408. swinging = true
  409. for i=1, 6 do
  410. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.3,-0.1,-0.2)
  411. lw.C0 = lw.C0 * CFrame.fromEulerAnglesXYZ(0.08,0,0.12)
  412. wait(0.04)
  413. end
  414. wait(0.05)
  415. hitting = true
  416. for i=1, 6 do
  417. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.3,-0.02,0.4)
  418. lw.C0 = lw.C0 * CFrame.fromEulerAnglesXYZ(-0.15,0,-0.25)
  419. wait(0.03)
  420. end
  421. wait(0.1)
  422. hitting = false
  423. for i=1, 3 do
  424. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.3,0.15,-0.1)
  425. lw.C0 = lw.C0 * CFrame.fromEulerAnglesXYZ(0.15,0.1,0.25)
  426. wait(0.03)
  427. end
  428. rw.C0 = CFrame.new(0,0,0)
  429. lw.C0 = CFrame.new(0,0,0)
  430. swinging = false
  431. elseif (key == "e") then
  432. function att2(rw,lw,armweld)
  433. end
  434. end
  435. end)
  436. end
  437.  
  438. function desel()
  439. sele = false
  440. lw.Part0 = nil
  441. lw.Part1 = nil
  442. for i=1, 7 do
  443. wait(0.03)
  444. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.2,-0.1,0.05)
  445. end
  446. for i=1, 5 do
  447. wait(0.03)
  448. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.3,-0.15,-0.2)
  449. end
  450. wait(0.03)
  451. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(-0.2,0.2,0.2)
  452. wait(0.02)
  453. wephold.Part0 = wephold.Parent
  454. wephold.Part1 = mainhandle
  455. armweld.Part1 = nil
  456. wait(0.07)
  457. for i=1, 4 do
  458. wait(0.03)
  459. rw.C0 = rw.C0 * CFrame.fromEulerAnglesXYZ(0.3,0.25,0.1)
  460. end
  461. rw.C0 = CFrame.new(0,0,0)
  462. rw.Part0 = nil
  463. rw.Part1 = nil
  464. end
  465.  
  466. bin.Selected:connect(selected)
  467. bin.Deselected:connect(desel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement