seamty

Untitled

May 25th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.22 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local Mouse = Player:GetMouse()
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84.  
  85. ----Sandboxed game object that allows the usage of client-side methods and services
  86. --Real game object
  87. local _rg = game
  88.  
  89. --Metatable for fake service
  90. local fsmt = {
  91. __index = function(self,k)
  92. local s = rawget(self,"_RealService")
  93. if s then return s[k] end
  94. end,
  95. __newindex = function(self,k,v)
  96. local s = rawget(self,"_RealService")
  97. if s then s[k]=v end
  98. end,
  99. __call = function(self,...)
  100. local s = rawget(self,"_RealService")
  101. if s then return s(...) end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return self[s]
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. }
  120. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  121. g.service = g.GetService
  122.  
  123. g.RunService = FakeService({
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126.  
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132.  
  133. setmetatable(g,{
  134. __index=function(self,s)
  135. return _rg:GetService(s) or typeof(_rg[s])=="function"
  136. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  137. end,
  138. __newindex = fsmt.__newindex,
  139. __call = fsmt.__call
  140. })
  141. --Changing owner to fake player object to support owner:GetMouse()
  142. game,owner = g,g.Players.LocalPlayer
  143. end
  144.  
  145. local la = Instance.new("Weld")
  146. la.Parent = script.Parent["Left Arm"]
  147. la.Part0 = script.Parent.HumanoidRootPart
  148. la.Part1 = script.Parent["Left Arm"]
  149. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  150.  
  151. local ra = Instance.new("Weld")
  152. ra.Parent = script.Parent["Right Arm"]
  153. ra.Part0 = script.Parent.HumanoidRootPart
  154. ra.Part1 = script.Parent["Right Arm"]
  155. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.15)
  156.  
  157. local attack = false
  158. local mouse = game.Players[script.Parent.Name]:GetMouse()
  159. local d = false
  160. function damage(hit)
  161. local h = hit.Parent:findFirstChildOfClass("Humanoid")
  162. if h ~= nil and attack == true then
  163. h.Health = h.Health - math.random(10,20)
  164. end
  165. end
  166. local katana = Instance.new("Model")
  167. katana.Parent = script.Parent
  168. katana.Name = "Katana"
  169. local handle = Instance.new("Part")
  170. handle.Parent = katana
  171. handle.BrickColor = BrickColor.new('Really black')
  172. handle.Name = "Handle"
  173. handle.Size = Vector3.new(.5,2,.5)
  174. handle.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  175. handle.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  176. handle.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  177. handle.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  178. handle.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  179. handle.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  180. handle.CanCollide = false
  181. local hw = Instance.new("Weld")
  182. hw.Parent = handle
  183. hw.Part0 = handle
  184. hw.Part1 = script.Parent["Right Arm"]
  185. hw.C1 = CFrame.new(0,-1,.4) * CFrame.fromEulerAnglesXYZ(1.6,0,0)
  186.  
  187. local part = Instance.new("Part")
  188. part.Parent = katana
  189. part.BrickColor = BrickColor.new('Dark stone grey')
  190. part.Name = "KatanaPart"
  191. part.Size = Vector3.new(.5,.2,1)
  192. part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  193. part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  194. part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  195. part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  196. part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  197. part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  198. part.CanCollide = false
  199. local pw = Instance.new("Weld")
  200. pw.Parent = part
  201. pw.Part0 = part
  202. pw.Part1 = handle
  203. pw.C1 = CFrame.new(0,-1,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  204.  
  205. local part = Instance.new("Part")
  206. part.Parent = katana
  207. part.BrickColor = BrickColor.new('Dark stone grey')
  208. part.Name = "KatanaPart"
  209. part.Size = Vector3.new(.2,.2,.7)
  210. part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  211. part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  212. part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  213. part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  214. part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  215. part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  216. part.CanCollide = false
  217. local pw = Instance.new("Weld")
  218. pw.Parent = part
  219. pw.Part0 = part
  220. pw.Part1 = handle
  221. pw.C1 = CFrame.new(.35,-1,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  222.  
  223. local part = Instance.new("Part")
  224. part.Parent = katana
  225. part.BrickColor = BrickColor.new('Dark stone grey')
  226. part.Name = "KatanaPart"
  227. part.Size = Vector3.new(.2,.2,.7)
  228. part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  229. part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  230. part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  231. part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  232. part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  233. part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  234. part.CanCollide = false
  235. local pw = Instance.new("Weld")
  236. pw.Parent = part
  237. pw.Part0 = part
  238. pw.Part1 = handle
  239. pw.C1 = CFrame.new(-.35,-1,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  240.  
  241. local blade = Instance.new("Part")
  242. blade.Parent = katana
  243. blade.BrickColor = BrickColor.new('White')
  244. blade.Name = "DamagingBlade"
  245. blade.Size = Vector3.new(.1,3,.4)
  246. blade.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  247. blade.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  248. blade.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  249. blade.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  250. blade.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  251. blade.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  252. blade.CanCollide = false
  253. local bw = Instance.new("Weld")
  254. bw.Parent = blade
  255. bw.Part0 = blade
  256. bw.Part1 = handle
  257. bw.C1 = CFrame.new(0,-2.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  258.  
  259. local blade2 = Instance.new("Part")
  260. blade2.Parent = katana
  261. blade2.BrickColor = BrickColor.new('White')
  262. blade2.Name = "Blade"
  263. blade2.Size = Vector3.new(.1,.4,.2)
  264. blade2.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  265. blade2.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  266. blade2.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  267. blade2.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  268. blade2.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  269. blade2.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  270. blade2.CanCollide = false
  271. local bw2 = Instance.new("Weld")
  272. bw2.Parent = blade2
  273. bw2.Part0 = blade2
  274. bw2.Part1 = handle
  275. bw2.C1 = CFrame.new(0,-4.2,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  276.  
  277. local a0 = Instance.new("Attachment")
  278. a0.Parent = blade
  279. a0.Position = Vector3.new(0,1.5,0)
  280.  
  281. local a1 = Instance.new("Attachment")
  282. a1.Parent = blade
  283. a1.Position = Vector3.new(0,-2,0)
  284.  
  285. local trail = Instance.new("Trail")
  286. trail.Parent = blade
  287. trail.Transparency = NumberSequence.new(.5,1)
  288. trail.Attachment0 = a0
  289. trail.Attachment1 = a1
  290. trail.Lifetime = .1
  291. function attack()
  292. if d == false then
  293. local attackID = 0
  294. attackID = math.random(1,2)
  295. attack = true
  296. d = true
  297. if attackID == 1 then
  298.  
  299. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  300. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.15)
  301. wait(.01)
  302. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  303. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.4)
  304. wait(.05)
  305. la.C1 = CFrame.new(1,-.1,.35) * CFrame.fromEulerAnglesXYZ(-1,.9,0)
  306. ra.C1 = CFrame.new(-1,0,.7) * CFrame.fromEulerAnglesXYZ(-1,-.2,.4)
  307. wait(.05)
  308. la.C1 = CFrame.new(1,.1,.2) * CFrame.fromEulerAnglesXYZ(-.5,.9,0)
  309. ra.C1 = CFrame.new(-1,.2,.5) * CFrame.fromEulerAnglesXYZ(-.5,-.2,.4)
  310. wait(.05)
  311. la.C1 = CFrame.new(1,.1,.1) * CFrame.fromEulerAnglesXYZ(0,.9,0)
  312. ra.C1 = CFrame.new(-1,.2,.3) * CFrame.fromEulerAnglesXYZ(0,-.2,.4)
  313. wait(.05)
  314. la.C1 = CFrame.new(1,.1,.2) * CFrame.fromEulerAnglesXYZ(-.5,.9,0)
  315. ra.C1 = CFrame.new(-1,.2,.5) * CFrame.fromEulerAnglesXYZ(-.5,-.2,.4)
  316. wait(.05)
  317. la.C1 = CFrame.new(1,-.1,.35) * CFrame.fromEulerAnglesXYZ(-1,.9,0)
  318. ra.C1 = CFrame.new(-1,0,.7) * CFrame.fromEulerAnglesXYZ(-1,-.2,.4)
  319. wait(.01)
  320. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  321. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.4)
  322. wait(.01)
  323. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  324. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.15)
  325. end
  326. if attackID == 2 then
  327. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  328. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.15)
  329. wait(.01)
  330. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,.3)
  331. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.5)
  332. wait(.01)
  333. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,.6)
  334. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.8)
  335. wait(.05)
  336. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1,.9,.6)
  337. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1,-.2,.8)
  338. wait(.05)
  339. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-.5,.9,.6)
  340. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-.5,-.2,.8)
  341. wait(.05)
  342. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1,.9,.6)
  343. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1,-.2,.8)
  344. wait(.1)
  345. la.C1 = CFrame.new(1,.3,.35) * CFrame.fromEulerAnglesXYZ(-1.5,.9,0)
  346. ra.C1 = CFrame.new(-1,.4,.7) * CFrame.fromEulerAnglesXYZ(-1.5,-.2,.15)
  347. end
  348. attack = false
  349. d = false
  350. end
  351. end
  352. mouse.Button1Down:connect(attack)
  353. blade.Touched:connect(damage)
Add Comment
Please, Sign In to add comment