lafur

Untitled

May 5th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 V2 by Mokiros")
  6. local RealPlayer = RealPlayer
  7. script.Parent = RealPlayer.Character
  8.  
  9. --Fake event to make stuff like Mouse.KeyDown work
  10. local Disconnect_Function = function(this)
  11. this[1].Functions[this[2]] = nil
  12. end
  13. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  14. local FakeEvent_Metatable = {__index={
  15. Connect = function(this,f)
  16. local i = tostring(math.random(0,10000))
  17. while this.Functions[i] do
  18. i = tostring(math.random(0,10000))
  19. end
  20. this.Functions[i] = f
  21. return setmetatable({this,i},Disconnect_Metatable)
  22. end
  23. }}
  24. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  25. local function fakeEvent()
  26. return setmetatable({Functions={}},FakeEvent_Metatable)
  27. end
  28.  
  29. --Creating fake input objects with fake variables
  30. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  31. FakeMouse.keyUp = FakeMouse.KeyUp
  32. FakeMouse.keyDown = FakeMouse.KeyDown
  33. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  34. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  35. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  36. end}
  37. --Merged 2 functions into one by checking amount of arguments
  38. CAS.UnbindAction = CAS.BindAction
  39.  
  40. --This function will trigger the events that have been :Connect()'ed
  41. local function TriggerEvent(self,ev,...)
  42. for _,f in pairs(self[ev].Functions) do
  43. f(...)
  44. end
  45. end
  46. FakeMouse.TriggerEvent = TriggerEvent
  47. UIS.TriggerEvent = TriggerEvent
  48.  
  49. --Client communication
  50. local Event = Instance.new("RemoteEvent")
  51. Event.Name = "UserInput_Event"
  52. Event.OnServerEvent:Connect(function(plr,io)
  53. if plr~=RealPlayer then return end
  54. FakeMouse.Target = io.Target
  55. FakeMouse.Hit = io.Hit
  56. if not io.isMouse then
  57. local b = io.UserInputState == Enum.UserInputState.Begin
  58. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  59. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  60. end
  61. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  62. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  63. end
  64. for _,t in pairs(CAS.Actions) do
  65. for _,k in pairs(t.Keys) do
  66. if k==io.KeyCode then
  67. t.Function(t.Name,io.UserInputState,io)
  68. end
  69. end
  70. end
  71. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  72. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  73. end
  74. end)
  75. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  76. local Mouse = owner:GetMouse()
  77. local UIS = game:GetService("UserInputService")
  78. local input = function(io,RobloxHandled)
  79. if RobloxHandled then return end
  80. --Since InputObject is a client-side instance, we create and pass table instead
  81. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  82. end
  83. UIS.InputBegan:Connect(input)
  84. UIS.InputEnded:Connect(input)
  85. local h,t
  86. --Give the server mouse data every second frame, but only if the values changed
  87. --If player is not moving their mouse, client won't fire events
  88. local HB = game:GetService("RunService").Heartbeat
  89. while true do
  90. if h~=Mouse.Hit or t~=Mouse.Target then
  91. h,t=Mouse.Hit,Mouse.Target
  92. Event:FireServer({isMouse=true,Target=t,Hit=h})
  93. end
  94. --Wait 2 frames
  95. for i=1,2 do
  96. HB:Wait()
  97. end
  98. end]==],script)
  99.  
  100. ----Sandboxed game object that allows the usage of client-side methods and services
  101. --Real game object
  102. local RealGame = game
  103.  
  104. --Metatable for fake service
  105. local FakeService_Metatable = {
  106. __index = function(self,k)
  107. local s = rawget(self,"_RealService")
  108. if s then
  109. return typeof(s[k])=="function"
  110. and function(_,...)return s[k](s,...)end or s[k]
  111. end
  112. end,
  113. __newindex = function(self,k,v)
  114. local s = rawget(self,"_RealService")
  115. if s then s[k]=v end
  116. end
  117. }
  118. local function FakeService(t,RealService)
  119. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  120. return setmetatable(t,FakeService_Metatable)
  121. end
  122.  
  123. --Fake game object
  124. local FakeGame = {
  125. GetService = function(self,s)
  126. return rawget(self,s) or RealGame:GetService(s)
  127. end,
  128. Players = FakeService({
  129. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  130. },"Players"),
  131. UserInputService = FakeService(UIS,"UserInputService"),
  132. ContextActionService = FakeService(CAS,"ContextActionService"),
  133. RunService = FakeService({
  134. _btrs = {},
  135. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  136. BindToRenderStep = function(self,name,_,fun)
  137. self._btrs[name] = self.Heartbeat:Connect(fun)
  138. end,
  139. UnbindFromRenderStep = function(self,name)
  140. self._btrs[name]:Disconnect()
  141. end,
  142. },"RunService")
  143. }
  144. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  145. FakeGame.service = FakeGame.GetService
  146. FakeService(FakeGame,game)
  147. --Changing owner to fake player object to support owner:GetMouse()
  148. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  149. end
  150.  
  151. Player = owner
  152. Character = Player.Character
  153. RightArm = Character.Right Arm
  154. Torso = Character.Torso
  155. RightHand = Character["RightArm"]
  156. Humanoid = Character.Humanoid
  157.  
  158.  
  159. --Converted with ttyyuu12345's model to script plugin v4
  160. function sandbox(var,func)
  161. local env = getfenv(func)
  162. local newenv = setmetatable({},{
  163. __index = function(self,k)
  164. if k=="script" then
  165. return var
  166. else
  167. return env[k]
  168. end
  169. end,
  170. })
  171. setfenv(func,newenv)
  172. return func
  173. end
  174. cors = {}
  175. mas = Instance.new("Model",game:GetService("Lighting"))
  176. Model0 = Instance.new("Model")
  177. Part1 = Instance.new("Part")
  178. Part2 = Instance.new("Part")
  179. Part3 = Instance.new("Part")
  180. Part4 = Instance.new("Part")
  181. SpecialMesh5 = Instance.new("SpecialMesh")
  182. Part6 = Instance.new("Part")
  183. Part7 = Instance.new("Part")
  184. Part8 = Instance.new("Part")
  185. Weld9 = Instance.new("Weld")
  186. Weld10 = Instance.new("Weld")
  187. Weld11 = Instance.new("Weld")
  188. Weld12 = Instance.new("Weld")
  189. Weld13 = Instance.new("Weld")
  190. Weld14 = Instance.new("Weld")
  191. Weld15 = Instance.new("Weld")
  192. Weld16 = Instance.new("Weld")
  193. Weld17 = Instance.new("Weld")
  194. Part18 = Instance.new("Part")
  195. Part19 = Instance.new("Part")
  196. SpecialMesh20 = Instance.new("SpecialMesh")
  197. Part21 = Instance.new("Part")
  198. Model0.Name = "Sword"
  199. Model0.Parent = mas
  200. Part1.Parent = Model0
  201. Part1.CFrame = CFrame.new(-5.5, 0.75, 7.12499714, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
  202. Part1.Orientation = Vector3.new(0, 90, -90)
  203. Part1.Position = Vector3.new(-5.5, 0.75, 7.12499714)
  204. Part1.Rotation = Vector3.new(0, 89.9599991, 0)
  205. Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
  206. Part1.Size = Vector3.new(0.5, 1.75, 0.5)
  207. Part1.BottomSurface = Enum.SurfaceType.Smooth
  208. Part1.BrickColor = BrickColor.new("Bright yellow")
  209. Part1.TopSurface = Enum.SurfaceType.Smooth
  210. Part1.brickColor = BrickColor.new("Bright yellow")
  211. Part2.Parent = Model0
  212. Part2.CFrame = CFrame.new(-5.5, 0.75, 8.37499809, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
  213. Part2.Orientation = Vector3.new(0, 90, -90)
  214. Part2.Position = Vector3.new(-5.5, 0.75, 8.37499809)
  215. Part2.Rotation = Vector3.new(0, 89.9599991, 0)
  216. Part2.Color = Color3.new(0.643137, 0.741176, 0.278431)
  217. Part2.Size = Vector3.new(0.5, 0.25, 0.5)
  218. Part2.BottomSurface = Enum.SurfaceType.Smooth
  219. Part2.BrickColor = BrickColor.new("Br. yellowish green")
  220. Part2.TopSurface = Enum.SurfaceType.Smooth
  221. Part2.brickColor = BrickColor.new("Br. yellowish green")
  222. Part3.Parent = Model0
  223. Part3.CFrame = CFrame.new(-5.5, 0.12500006, 7.99999619, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
  224. Part3.Orientation = Vector3.new(0, 90, -90)
  225. Part3.Position = Vector3.new(-5.5, 0.12500006, 7.99999619)
  226. Part3.Rotation = Vector3.new(0, 89.9700012, 0)
  227. Part3.Color = Color3.new(0.129412, 0.329412, 0.72549)
  228. Part3.Size = Vector3.new(0.25, 0.5, 0.5)
  229. Part3.BottomSurface = Enum.SurfaceType.Smooth
  230. Part3.BrickColor = BrickColor.new("Deep blue")
  231. Part3.TopSurface = Enum.SurfaceType.Smooth
  232. Part3.brickColor = BrickColor.new("Deep blue")
  233. Part4.Parent = Model0
  234. Part4.CFrame = CFrame.new(-5.5, 0.625, 5.99999809, 0.999999762, 0, 0, 0, 0, 1, 0, -1, 0)
  235. Part4.Orientation = Vector3.new(-90, 0, 0)
  236. Part4.Position = Vector3.new(-5.5, 0.625, 5.99999809)
  237. Part4.Rotation = Vector3.new(-90, 0, 0)
  238. Part4.Color = Color3.new(0.960784, 0.803922, 0.188235)
  239. Part4.Size = Vector3.new(0.5, 0.5, 0.25)
  240. Part4.BottomSurface = Enum.SurfaceType.Smooth
  241. Part4.BrickColor = BrickColor.new("Bright yellow")
  242. Part4.TopSurface = Enum.SurfaceType.Smooth
  243. Part4.brickColor = BrickColor.new("Bright yellow")
  244. SpecialMesh5.Parent = Part4
  245. SpecialMesh5.MeshType = Enum.MeshType.Wedge
  246. Part6.Parent = Model0
  247. Part6.CFrame = CFrame.new(-5.5, 0.749998033, 8.99999428, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
  248. Part6.Orientation = Vector3.new(0, 90, -90)
  249. Part6.Position = Vector3.new(-5.5, 0.749998033, 8.99999428)
  250. Part6.Rotation = Vector3.new(0, 89.9700012, 0)
  251. Part6.Color = Color3.new(0.643137, 0.741176, 0.278431)
  252. Part6.Size = Vector3.new(0.25, 1.5, 0.25)
  253. Part6.BottomSurface = Enum.SurfaceType.Smooth
  254. Part6.BrickColor = BrickColor.new("Br. yellowish green")
  255. Part6.TopSurface = Enum.SurfaceType.Smooth
  256. Part6.brickColor = BrickColor.new("Br. yellowish green")
  257. Part7.Parent = Model0
  258. Part7.CFrame = CFrame.new(-5.5, 1.37499809, 7.99999619, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
  259. Part7.Orientation = Vector3.new(0, 90, -90)
  260. Part7.Position = Vector3.new(-5.5, 1.37499809, 7.99999619)
  261. Part7.Rotation = Vector3.new(0, 89.9599991, 0)
  262. Part7.Color = Color3.new(0.129412, 0.329412, 0.72549)
  263. Part7.Size = Vector3.new(0.25, 0.5, 0.5)
  264. Part7.BottomSurface = Enum.SurfaceType.Smooth
  265. Part7.BrickColor = BrickColor.new("Deep blue")
  266. Part7.TopSurface = Enum.SurfaceType.Smooth
  267. Part7.brickColor = BrickColor.new("Deep blue")
  268. Part8.Parent = Model0
  269. Part8.CFrame = CFrame.new(-5.5, 0.749997079, 8.12499619, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
  270. Part8.Orientation = Vector3.new(0, 90, -90)
  271. Part8.Position = Vector3.new(-5.5, 0.749997079, 8.12499619)
  272. Part8.Rotation = Vector3.new(0, 89.9700012, 0)
  273. Part8.Color = Color3.new(0.129412, 0.329412, 0.72549)
  274. Part8.Size = Vector3.new(1, 0.25, 0.5)
  275. Part8.BottomSurface = Enum.SurfaceType.Smooth
  276. Part8.BrickColor = BrickColor.new("Deep blue")
  277. Part8.TopSurface = Enum.SurfaceType.Smooth
  278. Part8.brickColor = BrickColor.new("Deep blue")
  279. Weld9.Name = "BTWeld"
  280. Weld9.Parent = Part8
  281. Weld9.C1 = CFrame.new(9.53674316e-07, 0.874998093, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  282. Weld9.Part0 = Part8
  283. Weld9.Part1 = Part6
  284. Weld9.part1 = Part6
  285. Weld10.Name = "BTWeld"
  286. Weld10.Parent = Part8
  287. Weld10.C1 = CFrame.new(-0.62499702, -0.125, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  288. Weld10.Part0 = Part8
  289. Weld10.Part1 = Part3
  290. Weld10.part1 = Part3
  291. Weld11.Name = "BTWeld"
  292. Weld11.Parent = Part8
  293. Weld11.C1 = CFrame.new(0, -0.25000298, -0.875003815, 0, 0, 0.99999994, -1, -5.56362707e-08, 0, 5.56362707e-08, -1, 0)
  294. Weld11.Part0 = Part8
  295. Weld11.Part1 = Part21
  296. Weld11.part1 = Part21
  297. Weld12.Name = "BTWeld"
  298. Weld12.Parent = Part8
  299. Weld12.C1 = CFrame.new(2.92062759e-06, 0.250001907, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
  300. Weld12.Part0 = Part8
  301. Weld12.Part1 = Part2
  302. Weld12.part1 = Part2
  303. Weld13.Name = "BTWeld"
  304. Weld13.Parent = Part8
  305. Weld13.C1 = CFrame.new(0.625001013, -0.125, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
  306. Weld13.Part0 = Part8
  307. Weld13.Part1 = Part7
  308. Weld13.part1 = Part7
  309. Weld14.Name = "BTWeld"
  310. Weld14.Parent = Part8
  311. Weld14.C1 = CFrame.new(2.92062759e-06, 1.50000191, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
  312. Weld14.Part0 = Part8
  313. Weld14.Part1 = Part18
  314. Weld14.part1 = Part18
  315. Weld15.Name = "BTWeld"
  316. Weld15.Parent = Part8
  317. Weld15.C1 = CFrame.new(2.92062759e-06, -0.999999046, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
  318. Weld15.Part0 = Part8
  319. Weld15.Part1 = Part1
  320. Weld15.part1 = Part1
  321. Weld16.Name = "BTWeld"
  322. Weld16.Parent = Part8
  323. Weld16.C1 = CFrame.new(0, -2.12499714, 0.125002921, 0, 0, -0.999999881, 0, 1, 0, 1, 0, 0)
  324. Weld16.Part0 = Part8
  325. Weld16.Part1 = Part19
  326. Weld16.part1 = Part19
  327. Weld17.Name = "BTWeld"
  328. Weld17.Parent = Part8
  329. Weld17.C1 = CFrame.new(0, -2.12499809, 0.124997079, 0, 0, 0.999999881, 0, 1, 0, -1, 0, 0)
  330. Weld17.Part0 = Part8
  331. Weld17.Part1 = Part4
  332. Weld17.part1 = Part4
  333. Part18.Name = "SwordHandle"
  334. Part18.Parent = Model0
  335. Part18.CFrame = CFrame.new(-5.5, 0.75, 9.62499809, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
  336. Part18.Orientation = Vector3.new(0, 90, -90)
  337. Part18.Position = Vector3.new(-5.5, 0.75, 9.62499809)
  338. Part18.Rotation = Vector3.new(0, 89.9599991, 0)
  339. Part18.Color = Color3.new(0.643137, 0.741176, 0.278431)
  340. Part18.Size = Vector3.new(0.5, 0.25, 0.5)
  341. Part18.BottomSurface = Enum.SurfaceType.Smooth
  342. Part18.BrickColor = BrickColor.new("Br. yellowish green")
  343. Part18.TopSurface = Enum.SurfaceType.Smooth
  344. Part18.brickColor = BrickColor.new("Br. yellowish green")
  345. Part19.Parent = Model0
  346. Part19.CFrame = CFrame.new(-5.5, 0.875, 5.99999905, -0.999999762, 0, 0, 0, 0, -1, 0, -1, 0)
  347. Part19.Orientation = Vector3.new(90, 180, 0)
  348. Part19.Position = Vector3.new(-5.5, 0.875, 5.99999905)
  349. Part19.Rotation = Vector3.new(90, 0, -180)
  350. Part19.Color = Color3.new(0.960784, 0.803922, 0.188235)
  351. Part19.Size = Vector3.new(0.5, 0.5, 0.25)
  352. Part19.BottomSurface = Enum.SurfaceType.Smooth
  353. Part19.BrickColor = BrickColor.new("Bright yellow")
  354. Part19.TopSurface = Enum.SurfaceType.Smooth
  355. Part19.brickColor = BrickColor.new("Bright yellow")
  356. SpecialMesh20.Parent = Part19
  357. SpecialMesh20.MeshType = Enum.MeshType.Wedge
  358. Part21.Name = "Hand"
  359. Part21.Parent = Model0
  360. Part21.CFrame = CFrame.new(-5.5, 1, 9, 0.99999994, 0, 0, 0, 1, -5.56362707e-08, 0, 5.56362707e-08, 1)
  361. Part21.Position = Vector3.new(-5.5, 1, 9)
  362. Part21.Size = Vector3.new(1, 0.300000012, 1)
  363. Part21.BottomSurface = Enum.SurfaceType.Smooth
  364. Part21.TopSurface = Enum.SurfaceType.Smooth
  365. for i,v in pairs(mas:GetChildren()) do
  366. v.Parent = Character
  367. pcall(function() v:MakeJoints() end)
  368. end
  369. mas:Destroy()
  370. for i,v in pairs(cors) do
  371. spawn(function()
  372. pcall(v)
  373. end)
  374. end
  375.  
  376. Model0.Hand.Transparency = 1
  377.  
  378. function CreateWeld(parent,name,a,b,cf)
  379. local Weld = Instance.new("Weld",parent)
  380. Weld.Name = name
  381. Weld.Part0 = a
  382. Weld.Part1 = b
  383. Weld.C0 = cf
  384. end
  385.  
  386. CreateWeld(Character,"SwordWeld",Model0.Hand,RightHand,CFrame.new(0, 0, 0))
  387. DMG = 0
  388.  
  389. mouse = Player:GetMouse()
  390.  
  391. Animation = Instance.new("Animation",Character)
  392. Animation.Name = "SlashAnimation"
  393. Animation.AnimationId = "rbxassetid://2524287767"
  394. SlashAnim = Humanoid:LoadAnimation(Animation)
  395.  
  396. mouse.Button1Down:connect(function()
  397. DMG = 15
  398. SlashAnim:Play()
  399. wait(.7)
  400. DMG = 0
  401. end)
  402.  
  403. Part1.Touched:connect(function(hit)
  404. local Human = hit.Parent:FindFirstChildOfClass("Humanoid")
  405. if Human then
  406. Human.Health = Human.Health - DMG
  407. end
  408. end)
Add Comment
Please, Sign In to add comment