Advertisement
Guest User

Roblox Fe script

a guest
Jan 21st, 2019
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.53 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 print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7. --Converted with ttyyuu12345's model to script plugin v4
  8. function sandbox(var,func)
  9. local env = getfenv(func)
  10. local newenv = setmetatable({},{
  11. __index = function(self,k)
  12. if k=="script" then
  13. return var
  14. else
  15. return env[k]
  16. end
  17. end,
  18. })
  19. setfenv(func,newenv)
  20. return func
  21. end
  22. cors = {}
  23. mas = Instance.new("Model",game:GetService("Lighting"))
  24. Camera0 = Instance.new("Camera")
  25. Tool1 = Instance.new("Tool")
  26. Part2 = Instance.new("Part")
  27. Part3 = Instance.new("Part")
  28. Script4 = Instance.new("Script")
  29. Part5 = Instance.new("Part")
  30. Script6 = Instance.new("Script")
  31. Script7 = Instance.new("Script")
  32. Script8 = Instance.new("Script")
  33. Camera0.Parent = mas
  34. Camera0.CFrame = CFrame.new(-18.7888851, 12.3762856, 46.64011, 0.658702195, 0.265955359, -0.703831851, -1.49011594e-08, 0.935444355, 0.35347423, 0.752403796, -0.232834235, 0.616179228)
  35. Camera0.CoordinateFrame = CFrame.new(-18.7888851, 12.3762856, 46.64011, 0.658702195, 0.265955359, -0.703831851, -1.49011594e-08, 0.935444355, 0.35347423, 0.752403796, -0.232834235, 0.616179228)
  36. Camera0.Focus = CFrame.new(-17.3812275, 11.6693401, 45.4077568, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  37. Camera0.focus = CFrame.new(-17.3812275, 11.6693401, 45.4077568, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  38. Tool1.Name = "BanHammer"
  39. Tool1.Parent = mas
  40. Tool1.Grip = CFrame.new(0, -0, -0, 1.19248806e-08, 0, -1, 0, 1, 0, 1, 0, 1.19248806e-08)
  41. Tool1.GripForward = Vector3.new(1, -0, -1.19248806e-08)
  42. Tool1.GripRight = Vector3.new(1.19248806e-08, 0, 1)
  43. Part2.Name = "Handle"
  44. Part2.Parent = Tool1
  45. Part2.CFrame = CFrame.new(9.5, 5, 20.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  46. Part2.Position = Vector3.new(9.5, 5, 20.5)
  47. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  48. Part2.Size = Vector3.new(1, 4, 1)
  49. Part2.BottomSurface = Enum.SurfaceType.Smooth
  50. Part2.BrickColor = BrickColor.new("Dark stone grey")
  51. Part2.TopSurface = Enum.SurfaceType.Smooth
  52. Part2.brickColor = BrickColor.new("Dark stone grey")
  53. Part3.Name = "BanPart"
  54. Part3.Parent = Tool1
  55. Part3.CFrame = CFrame.new(11.5, 8.5, 20.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  56. Part3.Position = Vector3.new(11.5, 8.5, 20.5)
  57. Part3.Color = Color3.new(1, 0, 0)
  58. Part3.Size = Vector3.new(1, 3, 3)
  59. Part3.BottomSurface = Enum.SurfaceType.Smooth
  60. Part3.BrickColor = BrickColor.new("Really red")
  61. Part3.TopSurface = Enum.SurfaceType.Smooth
  62. Part3.brickColor = BrickColor.new("Really red")
  63. Script4.Parent = Part3
  64. table.insert(cors,sandbox(Script4,function()
  65. function onTouched (hit)
  66. if hit.Parent:FindFirstChild("Humanoid") then
  67. local humanoid = hit.Parent:WaitForChild("Humanoid")
  68. local playername = hit.Parent.Name
  69. local player = game.Players:FindFirstChild(playername)
  70. player:Kick("Banned by Ban Hammer!")
  71. print("The ban hammer has Banned"..playername)
  72. end
  73.  
  74. end
  75. script.Parent.Touched:connect(onTouched)
  76. end))
  77. Part5.Parent = Tool1
  78. Part5.CFrame = CFrame.new(9, 8.5, 20.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  79. Part5.Position = Vector3.new(9, 8.5, 20.5)
  80. Part5.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  81. Part5.Size = Vector3.new(4, 3, 3)
  82. Part5.BottomSurface = Enum.SurfaceType.Smooth
  83. Part5.BrickColor = BrickColor.new("Really black")
  84. Part5.TopSurface = Enum.SurfaceType.Smooth
  85. Part5.brickColor = BrickColor.new("Really black")
  86. Script6.Name = "qPerfectionWeld"
  87. Script6.Parent = Tool1
  88. table.insert(cors,sandbox(Script6,function()
  89. -- Created by Quenty (@Quenty, follow me on twitter).
  90. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  91. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  92.  
  93. --[[ INSTRUCTIONS
  94. - Place in the model
  95. - Make sure model is anchored
  96. - That's it. It will weld the model and all children.
  97.  
  98. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  99. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  100. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  101. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  102. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  103. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  104. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  105. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  106.  
  107. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  108. ]]
  109.  
  110. --[[ DOCUMENTATION
  111. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  112. - Will work in PBS servers
  113. - Will work as long as it starts out with the part anchored
  114. - Stores the relative CFrame as a CFrame value
  115. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  116. - Utilizes a recursive algorith to find all parts in the model
  117. - Will reweld on script reparent if the script is initially parented to a tool.
  118. - Welds as fast as possible
  119. ]]
  120.  
  121. -- qPerfectionWeld.lua
  122. -- Created 10/6/2014
  123. -- Author: Quenty
  124. -- Version 1.0.3
  125.  
  126. -- Updated 10/14/2014 - Updated to 1.0.1
  127. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  128.  
  129. -- Updated 10/14/2014 - Updated to 1.0.2
  130. --- Fixed bug fix.
  131.  
  132. -- Updated 10/14/2014 - Updated to 1.0.3
  133. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  134.  
  135. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  136.  
  137.  
  138. local function CallOnChildren(Instance, FunctionToCall)
  139. -- Calls a function on each of the children of a certain object, using recursion.
  140.  
  141. FunctionToCall(Instance)
  142.  
  143. for _, Child in next, Instance:GetChildren() do
  144. CallOnChildren(Child, FunctionToCall)
  145. end
  146. end
  147.  
  148. local function GetNearestParent(Instance, ClassName)
  149. -- Returns the nearest parent of a certain class, or returns nil
  150.  
  151. local Ancestor = Instance
  152. repeat
  153. Ancestor = Ancestor.Parent
  154. if Ancestor == nil then
  155. return nil
  156. end
  157. until Ancestor:IsA(ClassName)
  158.  
  159. return Ancestor
  160. end
  161.  
  162. local function GetBricks(StartInstance)
  163. local List = {}
  164.  
  165. -- if StartInstance:IsA("BasePart") then
  166. -- List[#List+1] = StartInstance
  167. -- end
  168.  
  169. CallOnChildren(StartInstance, function(Item)
  170. if Item:IsA("BasePart") then
  171. List[#List+1] = Item;
  172. end
  173. end)
  174.  
  175. return List
  176. end
  177.  
  178. local function Modify(Instance, Values)
  179. -- Modifies an Instance by using a table.
  180.  
  181. assert(type(Values) == "table", "Values is not a table");
  182.  
  183. for Index, Value in next, Values do
  184. if type(Index) == "number" then
  185. Value.Parent = Instance
  186. else
  187. Instance[Index] = Value
  188. end
  189. end
  190. return Instance
  191. end
  192.  
  193. local function Make(ClassType, Properties)
  194. -- Using a syntax hack to create a nice way to Make new items.
  195.  
  196. return Modify(Instance.new(ClassType), Properties)
  197. end
  198.  
  199. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  200. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  201.  
  202. local function HasWheelJoint(Part)
  203. for _, SurfaceName in pairs(Surfaces) do
  204. for _, HingSurfaceName in pairs(HingSurfaces) do
  205. if Part[SurfaceName].Name == HingSurfaceName then
  206. return true
  207. end
  208. end
  209. end
  210.  
  211. return false
  212. end
  213.  
  214. local function ShouldBreakJoints(Part)
  215. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  216. -- definitely some edge cases.
  217.  
  218. if NEVER_BREAK_JOINTS then
  219. return false
  220. end
  221.  
  222. if HasWheelJoint(Part) then
  223. return false
  224. end
  225.  
  226. local Connected = Part:GetConnectedParts()
  227.  
  228. if #Connected == 1 then
  229. return false
  230. end
  231.  
  232. for _, Item in pairs(Connected) do
  233. if HasWheelJoint(Item) then
  234. return false
  235. elseif not Item:IsDescendantOf(script.Parent) then
  236. return false
  237. end
  238. end
  239.  
  240. return true
  241. end
  242.  
  243. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  244. --- Weld's 2 parts together
  245. -- @param Part0 The first part
  246. -- @param Part1 The second part (Dependent part most of the time).
  247. -- @param [JointType] The type of joint. Defaults to weld.
  248. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  249. -- @return The weld created.
  250.  
  251. JointType = JointType or "Weld"
  252. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  253.  
  254. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  255. Modify(NewWeld, {
  256. Name = "qCFrameWeldThingy";
  257. Part0 = Part0;
  258. Part1 = Part1;
  259. C0 = CFrame.new();--Part0.CFrame:inverse();
  260. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  261. Parent = Part1;
  262. })
  263.  
  264. if not RelativeValue then
  265. RelativeValue = Make("CFrameValue", {
  266. Parent = Part1;
  267. Name = "qRelativeCFrameWeldValue";
  268. Archivable = true;
  269. Value = NewWeld.C1;
  270. })
  271. end
  272.  
  273. return NewWeld
  274. end
  275.  
  276. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  277. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  278. -- @param MainPart The part to weld the model to (can be in the model).
  279. -- @param [JointType] The type of joint. Defaults to weld.
  280. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  281.  
  282. for _, Part in pairs(Parts) do
  283. if ShouldBreakJoints(Part) then
  284. Part:BreakJoints()
  285. end
  286. end
  287.  
  288. for _, Part in pairs(Parts) do
  289. if Part ~= MainPart then
  290. WeldTogether(MainPart, Part, JointType, MainPart)
  291. end
  292. end
  293.  
  294. if not DoNotUnanchor then
  295. for _, Part in pairs(Parts) do
  296. Part.Anchored = false
  297. end
  298. MainPart.Anchored = false
  299. end
  300. end
  301.  
  302. local function PerfectionWeld()
  303. local Tool = GetNearestParent(script, "Tool")
  304.  
  305. local Parts = GetBricks(script.Parent)
  306. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  307.  
  308. if PrimaryPart then
  309. WeldParts(Parts, PrimaryPart, "Weld", false)
  310. else
  311. warn("qWeld - Unable to weld part")
  312. end
  313.  
  314. return Tool
  315. end
  316.  
  317. local Tool = PerfectionWeld()
  318.  
  319.  
  320. if Tool and script.ClassName == "Script" then
  321. --- Don't bother with local scripts
  322.  
  323. script.Parent.AncestryChanged:connect(function()
  324. PerfectionWeld()
  325. end)
  326. end
  327.  
  328. -- Created by Quenty (@Quenty, follow me on twitter).
  329.  
  330. end))
  331. Script7.Name = "SwordScript"
  332. Script7.Parent = Tool1
  333. table.insert(cors,sandbox(Script7,function()
  334. -------- OMG HAX
  335.  
  336. r = game:service("RunService")
  337.  
  338.  
  339. local damage = 0
  340.  
  341.  
  342. local slash_damage = 0
  343.  
  344.  
  345. sword = script.Parent.Handle
  346. Tool = script.Parent
  347.  
  348.  
  349. local SlashSound = Instance.new("Sound")
  350. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  351. SlashSound.Parent = sword
  352. SlashSound.Volume = .7
  353.  
  354.  
  355. local UnsheathSound = Instance.new("Sound")
  356. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  357. UnsheathSound.Parent = sword
  358. UnsheathSound.Volume = 1
  359.  
  360.  
  361. function blow(hit)
  362. local humanoid = hit.Parent:findFirstChild("Humanoid of the Monster here ( make sure its humanoid is not named humanoid)")
  363. local vCharacter = Tool.Parent
  364. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  365. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  366. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  367. -- final check, make sure sword is in-hand
  368.  
  369. local right_arm = vCharacter:FindFirstChild("Right Arm")
  370. if (right_arm ~= nil) then
  371. local joint = right_arm:FindFirstChild("RightGrip")
  372. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  373. tagHumanoid(humanoid, vPlayer)
  374. humanoid:TakeDamage(damage)
  375. wait(1)
  376. untagHumanoid(humanoid)
  377. end
  378. end
  379.  
  380.  
  381. end
  382. end
  383.  
  384.  
  385. function tagHumanoid(humanoid, player)
  386. local creator_tag = Instance.new("ObjectValue")
  387. creator_tag.Value = player
  388. creator_tag.Name = "creator"
  389. creator_tag.Parent = humanoid
  390. end
  391.  
  392. function untagHumanoid(humanoid)
  393. if humanoid ~= nil then
  394. local tag = humanoid:findFirstChild("creator")
  395. if tag ~= nil then
  396. tag.Parent = nil
  397. end
  398. end
  399. end
  400.  
  401.  
  402. function attack()
  403. damage = slash_damage
  404. SlashSound:play()
  405. local anim = Instance.new("StringValue")
  406. anim.Name = "toolanim"
  407. anim.Value = "Slash"
  408. anim.Parent = Tool
  409. end
  410.  
  411.  
  412. function swordUp()
  413. Tool.GripForward = Vector3.new(-1,0,0)
  414. Tool.GripRight = Vector3.new(0,1,0)
  415. Tool.GripUp = Vector3.new(0,0,1)
  416. end
  417.  
  418. function swordOut()
  419. Tool.GripForward = Vector3.new(0,0,1)
  420. Tool.GripRight = Vector3.new(0,-1,0)
  421. Tool.GripUp = Vector3.new(-1,0,0)
  422. end
  423.  
  424.  
  425.  
  426. Tool.Enabled = true
  427.  
  428. function onActivated()
  429.  
  430. if not Tool.Enabled then
  431. return
  432. end
  433.  
  434. Tool.Enabled = false
  435.  
  436. local character = Tool.Parent;
  437. local humanoid = character.Humanoid
  438. if humanoid == nil then
  439. print("Humanoid not found")
  440. return
  441. end
  442.  
  443.  
  444.  
  445. attack()
  446.  
  447. wait(.5)
  448.  
  449. Tool.Enabled = true
  450. end
  451.  
  452.  
  453. function onEquipped()
  454. UnsheathSound:play()
  455. end
  456.  
  457.  
  458. script.Parent.Activated:connect(onActivated)
  459. script.Parent.Equipped:connect(onEquipped)
  460.  
  461.  
  462. connection = sword.Touched:connect(blow)
  463.  
  464.  
  465.  
  466. end))
  467. Script8.Parent = mas
  468. table.insert(cors,sandbox(Script8,function()
  469. warn("created by: 5k5k5k5k5 left click to BAN!")
  470. end))
  471. for i,v in pairs(mas:GetChildren()) do
  472. v.Parent = workspace
  473. pcall(function() v:MakeJoints() end)
  474. end
  475. mas:Destroy()
  476. for i,v in pairs(cors) do
  477. spawn(function()
  478. pcall(v)
  479. end)
  480. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement