· 7 years ago · Feb 08, 2019, 08:12 AM
1--https://github.com/Mokiros/roblox-FE-compatibility
2if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3local Player,game,owner = owner,game
4local RealPlayer = Player
5do 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
8function 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
21end
22cors = {}
23mas = Instance.new("Model",game:GetService("Lighting"))
24Camera0 = Instance.new("Camera")
25Tool1 = Instance.new("Tool")
26Part2 = Instance.new("Part")
27Script3 = Instance.new("Script")
28Script4 = Instance.new("Script")
29Part5 = Instance.new("Part")
30Script6 = Instance.new("Script")
31Script7 = Instance.new("Script")
32Script8 = Instance.new("Script")
33Camera0.Parent = mas
34Camera0.CFrame = CFrame.new(-0.682961583, 0.0680155829, -0.727280557, -0.728968799, 0.0465598702, -0.682961762, -0, 0.99768436, 0.0680155978, 0.684546947, 0.0495812483, -0.727280736)
35Camera0.CoordinateFrame = CFrame.new(-0.682961583, 0.0680155829, -0.727280557, -0.728968799, 0.0465598702, -0.682961762, -0, 0.99768436, 0.0680155978, 0.684546947, 0.0495812483, -0.727280736)
36Camera0.Focus = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
37Camera0.focus = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
38Tool1.Name = "BanHammer"
39Tool1.Parent = mas
40Tool1.Grip = CFrame.new(1.25508499, 0, -0, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 1)
41Tool1.GripPos = Vector3.new(1.25508499, 0, -0)
42Tool1.GripRight = Vector3.new(-4.37113883e-08, 1, 0)
43Tool1.GripUp = Vector3.new(-1, -4.37113883e-08, 0)
44Part2.Name = "Handle"
45Part2.Parent = Tool1
46Part2.CFrame = CFrame.new(11.5, 3, 15.5, 0, 0, 1, -1, 0, 0, 0, -1, 0)
47Part2.Orientation = Vector3.new(0, 90, -90)
48Part2.Position = Vector3.new(11.5, 3, 15.5)
49Part2.Rotation = Vector3.new(-90, 90, 0)
50Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
51Part2.Size = Vector3.new(6, 1, 1)
52Part2.BottomSurface = Enum.SurfaceType.Smooth
53Part2.BrickColor = BrickColor.new("Dark stone grey")
54Part2.TopSurface = Enum.SurfaceType.Smooth
55Part2.brickColor = BrickColor.new("Dark stone grey")
56Part2.Shape = Enum.PartType.Cylinder
57Script3.Name = "SwordScript"
58Script3.Parent = Tool1
59table.insert(cors,sandbox(Script3,function()
60-------- OMG HAX
61
62r = game:service("RunService")
63
64
65local damage = 0
66
67
68local slash_damage = 0
69
70
71sword = script.Parent.Handle
72Tool = script.Parent
73
74
75local SlashSound = Instance.new("Sound")
76SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
77SlashSound.Parent = sword
78SlashSound.Volume = .7
79
80
81local UnsheathSound = Instance.new("Sound")
82UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
83UnsheathSound.Parent = sword
84UnsheathSound.Volume = 1
85
86
87function blow(hit)
88 local humanoid = hit.Parent:findFirstChild("Humanoid of the Monster here ( make sure its humanoid is not named humanoid)")
89 local vCharacter = Tool.Parent
90 local vPlayer = game.Players:playerFromCharacter(vCharacter)
91 local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
92 if humanoid~=nil and humanoid ~= hum and hum ~= nil then
93 -- final check, make sure sword is in-hand
94
95 local right_arm = vCharacter:FindFirstChild("Right Arm")
96 if (right_arm ~= nil) then
97 local joint = right_arm:FindFirstChild("RightGrip")
98 if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
99 tagHumanoid(humanoid, vPlayer)
100 humanoid:TakeDamage(damage)
101 wait(1)
102 untagHumanoid(humanoid)
103 end
104 end
105
106
107 end
108end
109
110
111function tagHumanoid(humanoid, player)
112 local creator_tag = Instance.new("ObjectValue")
113 creator_tag.Value = player
114 creator_tag.Name = "creator"
115 creator_tag.Parent = humanoid
116end
117
118function untagHumanoid(humanoid)
119 if humanoid ~= nil then
120 local tag = humanoid:findFirstChild("creator")
121 if tag ~= nil then
122 tag.Parent = nil
123 end
124 end
125end
126
127
128function attack()
129 damage = slash_damage
130 SlashSound:play()
131 local anim = Instance.new("StringValue")
132 anim.Name = "toolanim"
133 anim.Value = "Slash"
134 anim.Parent = Tool
135end
136
137
138function swordUp()
139 Tool.GripForward = Vector3.new(-1,0,0)
140 Tool.GripRight = Vector3.new(0,1,0)
141 Tool.GripUp = Vector3.new(0,0,1)
142end
143
144function swordOut()
145 Tool.GripForward = Vector3.new(0,0,1)
146 Tool.GripRight = Vector3.new(0,-1,0)
147 Tool.GripUp = Vector3.new(-1,0,0)
148end
149
150
151
152Tool.Enabled = true
153
154function onActivated()
155
156 if not Tool.Enabled then
157 return
158 end
159
160 Tool.Enabled = false
161
162 local character = Tool.Parent;
163 local humanoid = character.Humanoid
164 if humanoid == nil then
165 print("Humanoid not found")
166 return
167 end
168
169
170
171 attack()
172
173 wait(.5)
174
175 Tool.Enabled = true
176end
177
178
179function onEquipped()
180 UnsheathSound:play()
181end
182
183
184script.Parent.Activated:connect(onActivated)
185script.Parent.Equipped:connect(onEquipped)
186
187
188connection = sword.Touched:connect(blow)
189
190
191
192end))
193Script4.Name = "qPerfectionWeld"
194Script4.Parent = Tool1
195table.insert(cors,sandbox(Script4,function()
196-- Created by Quenty (@Quenty, follow me on twitter).
197-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
198-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
199
200--[[ INSTRUCTIONS
201- Place in the model
202- Make sure model is anchored
203- That's it. It will weld the model and all children.
204
205THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
206THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
207THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
208THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
209THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
210THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
211THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
212THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
213
214This 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.
215]]
216
217--[[ DOCUMENTATION
218- 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.
219- Will work in PBS servers
220- Will work as long as it starts out with the part anchored
221- Stores the relative CFrame as a CFrame value
222- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
223- Utilizes a recursive algorith to find all parts in the model
224- Will reweld on script reparent if the script is initially parented to a tool.
225- Welds as fast as possible
226]]
227
228-- qPerfectionWeld.lua
229-- Created 10/6/2014
230-- Author: Quenty
231-- Version 1.0.3
232
233-- Updated 10/14/2014 - Updated to 1.0.1
234--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
235
236-- Updated 10/14/2014 - Updated to 1.0.2
237--- Fixed bug fix.
238
239-- Updated 10/14/2014 - Updated to 1.0.3
240--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
241
242local 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).
243
244
245local function CallOnChildren(Instance, FunctionToCall)
246 -- Calls a function on each of the children of a certain object, using recursion.
247
248 FunctionToCall(Instance)
249
250 for _, Child in next, Instance:GetChildren() do
251 CallOnChildren(Child, FunctionToCall)
252 end
253end
254
255local function GetNearestParent(Instance, ClassName)
256 -- Returns the nearest parent of a certain class, or returns nil
257
258 local Ancestor = Instance
259 repeat
260 Ancestor = Ancestor.Parent
261 if Ancestor == nil then
262 return nil
263 end
264 until Ancestor:IsA(ClassName)
265
266 return Ancestor
267end
268
269local function GetBricks(StartInstance)
270 local List = {}
271
272 -- if StartInstance:IsA("BasePart") then
273 -- List[#List+1] = StartInstance
274 -- end
275
276 CallOnChildren(StartInstance, function(Item)
277 if Item:IsA("BasePart") then
278 List[#List+1] = Item;
279 end
280 end)
281
282 return List
283end
284
285local function Modify(Instance, Values)
286 -- Modifies an Instance by using a table.
287
288 assert(type(Values) == "table", "Values is not a table");
289
290 for Index, Value in next, Values do
291 if type(Index) == "number" then
292 Value.Parent = Instance
293 else
294 Instance[Index] = Value
295 end
296 end
297 return Instance
298end
299
300local function Make(ClassType, Properties)
301 -- Using a syntax hack to create a nice way to Make new items.
302
303 return Modify(Instance.new(ClassType), Properties)
304end
305
306local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
307local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
308
309local function HasWheelJoint(Part)
310 for _, SurfaceName in pairs(Surfaces) do
311 for _, HingSurfaceName in pairs(HingSurfaces) do
312 if Part[SurfaceName].Name == HingSurfaceName then
313 return true
314 end
315 end
316 end
317
318 return false
319end
320
321local function ShouldBreakJoints(Part)
322 --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
323 -- definitely some edge cases.
324
325 if NEVER_BREAK_JOINTS then
326 return false
327 end
328
329 if HasWheelJoint(Part) then
330 return false
331 end
332
333 local Connected = Part:GetConnectedParts()
334
335 if #Connected == 1 then
336 return false
337 end
338
339 for _, Item in pairs(Connected) do
340 if HasWheelJoint(Item) then
341 return false
342 elseif not Item:IsDescendantOf(script.Parent) then
343 return false
344 end
345 end
346
347 return true
348end
349
350local function WeldTogether(Part0, Part1, JointType, WeldParent)
351 --- Weld's 2 parts together
352 -- @param Part0 The first part
353 -- @param Part1 The second part (Dependent part most of the time).
354 -- @param [JointType] The type of joint. Defaults to weld.
355 -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
356 -- @return The weld created.
357
358 JointType = JointType or "Weld"
359 local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
360
361 local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
362 Modify(NewWeld, {
363 Name = "qCFrameWeldThingy";
364 Part0 = Part0;
365 Part1 = Part1;
366 C0 = CFrame.new();--Part0.CFrame:inverse();
367 C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
368 Parent = Part1;
369 })
370
371 if not RelativeValue then
372 RelativeValue = Make("CFrameValue", {
373 Parent = Part1;
374 Name = "qRelativeCFrameWeldValue";
375 Archivable = true;
376 Value = NewWeld.C1;
377 })
378 end
379
380 return NewWeld
381end
382
383local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
384 -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
385 -- @param MainPart The part to weld the model to (can be in the model).
386 -- @param [JointType] The type of joint. Defaults to weld.
387 -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
388
389 for _, Part in pairs(Parts) do
390 if ShouldBreakJoints(Part) then
391 Part:BreakJoints()
392 end
393 end
394
395 for _, Part in pairs(Parts) do
396 if Part ~= MainPart then
397 WeldTogether(MainPart, Part, JointType, MainPart)
398 end
399 end
400
401 if not DoNotUnanchor then
402 for _, Part in pairs(Parts) do
403 Part.Anchored = false
404 end
405 MainPart.Anchored = false
406 end
407end
408
409local function PerfectionWeld()
410 local Tool = GetNearestParent(script, "Tool")
411
412 local Parts = GetBricks(script.Parent)
413 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]
414
415 if PrimaryPart then
416 WeldParts(Parts, PrimaryPart, "Weld", false)
417 else
418 warn("qWeld - Unable to weld part")
419 end
420
421 return Tool
422end
423
424local Tool = PerfectionWeld()
425
426
427if Tool and script.ClassName == "Script" then
428 --- Don't bother with local scripts
429
430 script.Parent.AncestryChanged:connect(function()
431 PerfectionWeld()
432 end)
433end
434
435-- Created by Quenty (@Quenty, follow me on twitter).
436
437end))
438Part5.Name = "Ban"
439Part5.Parent = Tool1
440Part5.CFrame = CFrame.new(11.5, 7.5, 15.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
441Part5.Position = Vector3.new(11.5, 7.5, 15.5)
442Part5.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
443Part5.Size = Vector3.new(5, 3, 3)
444Part5.BottomSurface = Enum.SurfaceType.Smooth
445Part5.BrickColor = BrickColor.new("Really black")
446Part5.TopSurface = Enum.SurfaceType.Smooth
447Part5.brickColor = BrickColor.new("Really black")
448Script6.Parent = Part5
449table.insert(cors,sandbox(Script6,function()
450function onTouched(hit)
451 local character = hit.Parent
452 if character and character:findFirstChild("Humanoid") then
453 local b = Instance.new("BodyPosition")
454 b.position = Vector3.new(500, 500, 500)
455 b.maxForce = Vector3.new(500000000, 500000000, 500000000)
456 b.Parent = character.Torso
457 wait(3)
458 b.Parent = nil
459 end
460end
461script.Parent.Touched:connect(onTouched)
462
463
464end))
465Script7.Parent = Part5
466table.insert(cors,sandbox(Script7,function()
467--Kill OnTouch :P
468
469function onTouch(part)
470 local humanoid = part.Parent:FindFirstChild("Humanoid")
471 if (humanoid ~= nil) then -- if a humanoid exists, then
472 wait(1)
473 humanoid.Health = 0 -- damage the humanoid
474end
475end
476
477script.Parent.Touched:connect(onTouch)
478
479--Made By XxAtrocity
480
481end))
482Script8.Parent = mas
483table.insert(cors,sandbox(Script8,function()
484print("are you ready for some killing?")
485end))
486for i,v in pairs(mas:GetChildren()) do
487 v.Parent = workspace
488 pcall(function() v:MakeJoints() end)
489end
490mas:Destroy()
491for i,v in pairs(cors) do
492 spawn(function()
493 pcall(v)
494 end)
495end