SHOW:
|
|
- or go back to the newest paste.
1 | - | local plr = game:GetService("Players").LocalPlayer |
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 local plr = game:GetService("Players").LocalPlayer | |
6 | local char = plr.Character | |
7 | ||
8 | function FindInTable(t, n) | |
9 | for i,v in pairs(t) do | |
10 | if v == n then | |
11 | return true | |
12 | end | |
13 | end | |
14 | return false | |
15 | end | |
16 | --Transformaaaaation-- | |
17 | char["Left Arm"].BrickColor = BrickColor.new("Pastel brown") | |
18 | char["Right Arm"].BrickColor = BrickColor.new("Pastel brown") | |
19 | char.Head.BrickColor = BrickColor.new("Pastel brown") | |
20 | char["Left Leg"].BrickColor = BrickColor.new("Pastel brown") | |
21 | char["Right Leg"].BrickColor = BrickColor.new("Pastel brown") | |
22 | ||
23 | for i,v in pairs(char:children'') do | |
24 | local toremove = {"CharacterMesh", "Shirt", "Pants", "ShirtGraphic", "Accessory"} | |
25 | if FindInTable(toremove, v.ClassName) then v:Destroy() end | |
26 | if v.ClassName == "BodyColors" then | |
27 | v.HeadColor = BrickColor.new("Pastel brown") | |
28 | v.LeftArmColor = BrickColor.new("Pastel brown") | |
29 | v.LeftLegColor = BrickColor.new("Pastel brown") | |
30 | v.RightArmColor = BrickColor.new("Pastel brown") | |
31 | v.RightLegColor = BrickColor.new("Pastel brown") | |
32 | v.TorsoColor = BrickColor.new("Pastel brown") | |
33 | end | |
34 | end | |
35 | ||
36 | local face = char.Head:FindFirstChild'face' if face then face.Texture = "http://www.roblox.com/asset/?id=31117192" end | |
37 | Instance.new("Shirt", char).ShirtTemplate = "http://www.roblox.com/asset/?id=812553202" | |
38 | Instance.new("Pants", char).PantsTemplate = "http://www.roblox.com/asset/?id=772799671" | |
39 | local function CreateHat(name, meshid, textureid) | |
40 | local h = Instance.new("Accessory") | |
41 | h.Name = name | |
42 | local han = Instance.new("Part", h) | |
43 | han.Name = "Handle" | |
44 | local mesh = Instance.new("SpecialMesh", han) | |
45 | mesh.Name = "Mesh" | |
46 | mesh.MeshId = meshid | |
47 | mesh.TextureId = textureid | |
48 | return h,han,mesh | |
49 | end | |
50 | hum = char:FindFirstChildOfClass'Humanoid' | |
51 | local h,han,mesh = CreateHat("2LEGITOwl", "http://www.roblox.com/asset/?id=0", "http://www.roblox.com/asset/?id=0") | |
52 | han.Size = Vector3.new(1, 1, 1) | |
53 | mesh.Scale = Vector3.new(0.3, 0.3, 0.3) | |
54 | h.AttachmentPos = Vector3.new(1.1, 0.38, 0) | |
55 | hum:AddAccessory(h) | |
56 | h,han,mesh = CreateHat("RobloxScarf", "http://www.roblox.com/asset/?id=0", "http://www.roblox.com/asset/?id=0") | |
57 | mesh.Scale = Vector3.new(3, 3, 3) | |
58 | han.Size = Vector3.new(1.9, 2, 2) | |
59 | h.AttachmentPos = Vector3.new(0, 1.54, 0.1) | |
60 | hum:AddAccessory(h) | |
61 | h,han,mesh = CreateHat("Dapper Stan", "http://www.roblox.com/asset/?id=74879498", "http://www.roblox.com/asset/?id=74879471") | |
62 | mesh.Scale = Vector3.new(1.05, 1.05, 1.05) | |
63 | han.Size = Vector3.new(2, 2, 2) | |
64 | hum:AddAccessory(h) | |
65 | ||
66 | local s = Instance.new("Sound") | |
67 | ||
68 | s,s2 = Instance.new('Sound'),Instance.new('Sound') | |
69 | ||
70 | s.SoundId = "http://www.roblox.com/asset/?id=1362139713" -- Type your music ID here | |
71 | s.Volume = 7 -- this is the Volume | |
72 | s.Pitch = 1 -- tis is the pich | |
73 | s.Looped = false | |
74 | s.archivable = false | |
75 | ||
76 | s.Parent = game.Workspace | |
77 | ||
78 | - | s2.SoundId = "http://www.roblox.com/asset/?id=1280498161" -- Type your music ID here |
78 | + | |
79 | ||
80 | s:play() | |
81 | ||
82 | s2.SoundId = "http://www.roblox.com/asset/?id=264396581" -- Type your music ID here | |
83 | s2.Volume = 0.7 -- this is the Volume | |
84 | s2.Pitch = 1 -- tis is the pich | |
85 | s2.Looped = true | |
86 | s2.archivable = false | |
87 | ||
88 | s2.Parent = game.Workspace | |
89 | ||
90 | wait(9) | |
91 | ||
92 | s2:play() | |
93 | ||
94 | ||
95 | ||
96 | ||
97 | -- Made by 1ndrew | |
98 | function sandbox(var,func) | |
99 | local env = getfenv(func) | |
100 | local newenv = setmetatable({},{ | |
101 | __index = function(self,k) | |
102 | if k=="script" then | |
103 | return var | |
104 | else | |
105 | return env[k] | |
106 | end | |
107 | end, | |
108 | }) | |
109 | setfenv(func,newenv) | |
110 | return func | |
111 | end | |
112 | cors = {} | |
113 | mas = Instance.new("Model",game:GetService("Lighting")) | |
114 | Tool0 = Instance.new("Tool") | |
115 | LocalScript1 = Instance.new("LocalScript") | |
116 | Part2 = Instance.new("Part") | |
117 | LocalScript3 = Instance.new("LocalScript") | |
118 | Sound4 = Instance.new("Sound") | |
119 | Sound5 = Instance.new("Sound") | |
120 | Animation6 = Instance.new("Animation") | |
121 | SpecialMesh7 = Instance.new("SpecialMesh") | |
122 | Script8 = Instance.new("Script") | |
123 | LocalScript9 = Instance.new("LocalScript") | |
124 | LocalScript10 = Instance.new("LocalScript") | |
125 | Part11 = Instance.new("Part") | |
126 | CylinderMesh12 = Instance.new("CylinderMesh") | |
127 | Part13 = Instance.new("Part") | |
128 | Weld14 = Instance.new("Weld") | |
129 | CylinderMesh15 = Instance.new("CylinderMesh") | |
130 | Part16 = Instance.new("Part") | |
131 | CylinderMesh17 = Instance.new("CylinderMesh") | |
132 | Part18 = Instance.new("Part") | |
133 | CylinderMesh19 = Instance.new("CylinderMesh") | |
134 | LocalScript20 = Instance.new("LocalScript") | |
135 | Tool0.Name = "Brutal Stick" | |
136 | Tool0.Parent = mas | |
137 | Tool0.GripForward = Vector3.new(-0.425711513, 0.306347132, -0.851423025) | |
138 | Tool0.GripPos = Vector3.new(0, -1.29999995, 0.100000001) | |
139 | Tool0.GripRight = Vector3.new(0.89442718, 0, -0.44721359) | |
140 | Tool0.GripUp = Vector3.new(0.137002602, 0.951919854, 0.274005204) | |
141 | Tool0.ToolTip = "TIME TO DIE MOTHERFUCKERS" | |
142 | LocalScript1.Name = "Aiming" | |
143 | LocalScript1.Parent = Tool0 | |
144 | table.insert(cors,sandbox(LocalScript1,function() | |
145 | wait() | |
146 | Tool=script.Parent | |
147 | CP,Torso,g=nil,nil,nil | |
148 | armo1=CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
149 | armo2=CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
150 | getPos=function(Pos,TorsoPos) | |
151 | return Vector3.new(Pos.x,TorsoPos.y,Pos.z) | |
152 | end | |
153 | Turn=function(mouse,Torso,Gyro) | |
154 | g.cframe=CFrame.new(Torso.Position,getPos(mouse.Hit.p,Torso.Position)) | |
155 | offset=(Torso.Position.y-mouse.Hit.p.y)/125 | |
156 | mag=(Torso.Position-mouse.Hit.p).magnitude/125 | |
157 | offset=offset/mag | |
158 | arm=Torso:FindFirstChild("Right Shoulder") | |
159 | arm2=Torso:FindFirstChild("Left Shoulder") | |
160 | if arm~=nil then | |
161 | arm.C0=CFrame.new(1, 0.5, 0, 0, 0, 1, -6.48200512e-007, 1.00000274, 0, -1.00000274, -6.48200512e-007, 0)*CFrame.fromEulerAnglesXYZ(0,0,-offset) | |
162 | arm2.C0=CFrame.new(-1, 0.5, 0, 0, 0, -1, -6.48200512e-007, 1.00000274, 0, 1.00000274, -6.48200512e-007, 0)*CFrame.fromEulerAnglesXYZ(0,0,offset) | |
163 | end | |
164 | end | |
165 | Equi=function(mouse) | |
166 | wait(.01) | |
167 | local vCharacter = Tool.Parent | |
168 | local hum = vCharacter:findFirstChild("Humanoid") | |
169 | blah = hum:LoadAnimation(Tool.Handle.Idle) | |
170 | blah:Play() | |
171 | CP=Tool.Parent | |
172 | Torso=CP.Torso | |
173 | g=Instance.new("BodyGyro") | |
174 | g.P=18000 | |
175 | g.D=600 | |
176 | g.maxTorque=Vector3.new(80000,80000000,80000)*50000000000000000000000000 | |
177 | g.cframe=Torso.CFrame | |
178 | while true do | |
179 | if Tool.Parent.className~="Model" then | |
180 | break | |
181 | end | |
182 | Turn(mouse,Torso,g) | |
183 | wait() | |
184 | end | |
185 | blah:Stop() | |
186 | arm.C0=armo1 | |
187 | arm2.C0=armo2 | |
188 | g:Remove() | |
189 | end | |
190 | Tool.Equipped:connect(Equi) | |
191 | ||
192 | end)) | |
193 | Part2.Name = "Handle" | |
194 | Part2.Parent = Tool0 | |
195 | Part2.BrickColor = BrickColor.new("Dark stone grey") | |
196 | Part2.Transparency = 1 | |
197 | Part2.FormFactor = Enum.FormFactor.Custom | |
198 | Part2.Size = Vector3.new(0.200000003, 3.9199934, 0.829999506) | |
199 | Part2.CFrame = CFrame.new(-8.29998779, 3.99999809, -84.0001221, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
200 | Part2.BottomSurface = Enum.SurfaceType.Smooth | |
201 | Part2.TopSurface = Enum.SurfaceType.Smooth | |
202 | Part2.Color = Color3.new(0.388235, 0.372549, 0.384314) | |
203 | Part2.Position = Vector3.new(-8.29998779, 3.99999809, -84.0001221) | |
204 | Part2.Color = Color3.new(0.388235, 0.372549, 0.384314) | |
205 | LocalScript3.Name = "MacheteScript" | |
206 | LocalScript3.Parent = Part2 | |
207 | table.insert(cors,sandbox(LocalScript3,function() | |
208 | local UTIL = {} | |
209 | ||
210 | function UTIL.Class(tableIn,template) | |
211 | tableIn = tableIn or {} | |
212 | local mt = { | |
213 | __metatable = UTIL.DeepCopy(template); | |
214 | __index = UTIL.DeepCopy(template); | |
215 | } | |
216 | return setmetatable(tableIn, mt) | |
217 | end | |
218 | function UTIL.MakeClass(...) | |
219 | local arg = {...} | |
220 | assert(#arg>0, 'ERROR: class needs 1 argument or more') | |
221 | local members = arg[1] | |
222 | for i=2,#arg,1 do | |
223 | if type(arg[i])=='table' then | |
224 | for key,val in pairs(arg[i]) do | |
225 | if not members[key] then | |
226 | members[key] = val | |
227 | end | |
228 | end | |
229 | end | |
230 | end | |
231 | local function New(init) | |
232 | return UTIL.Class(init or {},members) | |
233 | end | |
234 | local function Copy(obj, ...) | |
235 | local newobj = obj:New(unpack(arg)) | |
236 | for n,v in pairs(obj) do newobj[n] = v end | |
237 | return newobj | |
238 | end | |
239 | members.New = New | |
240 | members.Copy = Copy | |
241 | return mt | |
242 | end | |
243 | ||
244 | function UTIL.DeepCopy(orig) | |
245 | local orig_type = type(orig) | |
246 | local copy | |
247 | if orig_type == 'table' then | |
248 | copy = {} | |
249 | for orig_key, orig_value in next, orig, nil do | |
250 | copy[UTIL.DeepCopy(orig_key)] = UTIL.DeepCopy(orig_value) | |
251 | end | |
252 | setmetatable(copy, UTIL.DeepCopy(getmetatable(orig))) | |
253 | else | |
254 | copy = orig | |
255 | end | |
256 | return copy | |
257 | end | |
258 | ||
259 | function UTIL.Instantiate(guiType) | |
260 | return function(data) | |
261 | local obj = Instance.new(guiType) | |
262 | for k, v in pairs(data) do | |
263 | if type(k) == 'number' then | |
264 | v.Parent = obj | |
265 | else | |
266 | obj[k] = v | |
267 | end | |
268 | end | |
269 | return obj | |
270 | end | |
271 | end | |
272 | ||
273 | function UTIL.RetroRegister(func,...) | |
274 | func() | |
275 | for _,i in ipairs({...}) do | |
276 | i:connect(func) | |
277 | end | |
278 | end | |
279 | ||
280 | function UTIL.WaitForValidCharacter(player) | |
281 | local character = player.Character | |
282 | if not character or not character.Parent or not character:FindFirstChild('Humanoid') or character.Humanoid.Health <= 0 then | |
283 | player.CharacterAdded:wait() | |
284 | wait(0) | |
285 | character = player.Character | |
286 | end | |
287 | return character | |
288 | end | |
289 | ||
290 | function UTIL.FindCharacterAncestor(subject) | |
291 | if subject and subject ~= Workspace then | |
292 | local humanoid = subject:FindFirstChild('Humanoid') | |
293 | if humanoid then | |
294 | return subject, humanoid | |
295 | else | |
296 | return UTIL.FindCharacterAncestor(subject.Parent) | |
297 | end | |
298 | end | |
299 | return nil | |
300 | end | |
301 | ||
302 | UTIL.AssetURL = 'http://www.roblox.com/asset/?id=' | |
303 | ||
304 | ||
305 | UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled | |
306 | do | |
307 | local suceeded,_ =pcall(function() game.Workspace.CurrentCamera:GetPanSpeed() end) | |
308 | UTIL.CanCheckPanSpeed = suceeded | |
309 | end | |
310 | ||
311 | ||
312 | local DebrisService = Game:GetService('Debris') | |
313 | local DebugPrintOffset = 0 | |
314 | function UTIL.Dprint(...) | |
315 | local line = '' | |
316 | for _, segment in pairs({...}) do | |
317 | line = line .. (line and ' ' or '') .. tostring(segment) | |
318 | end | |
319 | local gui = Instance.new('ScreenGui') | |
320 | local label = Instance.new('TextLabel') | |
321 | label.Text = line | |
322 | label.Size = UDim2.new(0.25, 0, 0.05, 0) | |
323 | label.BackgroundTransparency = 0.5 | |
324 | label.Position = UDim2.new(0, 0, 0, DebugPrintOffset) | |
325 | label.TextWrapped = true | |
326 | label.Parent = gui | |
327 | DebrisService:AddItem(gui, 30) | |
328 | gui.Parent = script.Parent | |
329 | DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0 | |
330 | end | |
331 | ||
332 | WeldUtil = {} | |
333 | ||
334 | ||
335 | do | |
336 | ||
337 | ||
338 | function WeldUtil.WeldBetween(a, b) | |
339 | local weld = Instance.new("Weld") | |
340 | weld.Part0 = a | |
341 | weld.Part1 = b | |
342 | weld.C0 = CFrame.new() | |
343 | weld.C1 = b.CFrame:inverse() * a.CFrame | |
344 | ||
345 | weld.Parent = a | |
346 | return weld | |
347 | end | |
348 | ||
349 | function WeldUtil:PermaWeld(weld) | |
350 | local OriginalParent = weld.Parent | |
351 | weld.Changed:connect(function() | |
352 | Delay(0,function() weld.Parent = OriginalParent end) | |
353 | end) | |
354 | end | |
355 | ||
356 | end | |
357 | ||
358 | local InternalEvent = | |
359 | { | |
360 | Listeners = nil, | |
361 | } | |
362 | do | |
363 | UTIL.MakeClass(InternalEvent) | |
364 | function InternalEvent:Connect(func) | |
365 | if not self.Listeners then self.Listeners = {} end | |
366 | table.insert(self.Listeners,func) | |
367 | end | |
368 | function InternalEvent:Fire(...) | |
369 | if not self.Listeners then return end | |
370 | local args = {...} | |
371 | for _,i in ipairs(self.Listeners) do | |
372 | Spawn(function() i(unpack(args)) end) | |
373 | end | |
374 | end | |
375 | end | |
376 | ||
377 | ||
378 | ||
379 | local SwordPart = | |
380 | { | |
381 | Damage = 25, | |
382 | AttackTime = 1, | |
383 | CoolDown = 0.1, | |
384 | ||
385 | LastSwing = 0, | |
386 | LastHit = 0, | |
387 | ||
388 | Part= nil, | |
389 | Owner = nil, | |
390 | ||
391 | OnHit = nil, | |
392 | OnHitHumanoid = nil, | |
393 | OnAttackReady = nil, | |
394 | OnAttack = nil, | |
395 | ||
396 | ||
397 | SwingSound = nil, | |
398 | HitSound = nil, | |
399 | SwingAnimation = nil, | |
400 | ||
401 | ActiveConnections = {}, | |
402 | ||
403 | } | |
404 | do | |
405 | UTIL.MakeClass(SwordPart) | |
406 | function SwordPart.New(npart,nowner) | |
407 | local init= UTIL.DeepCopy(SwordPart) | |
408 | init.Part= npart | |
409 | init.Owner = nowner | |
410 | table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end)) | |
411 | ||
412 | init.OnHit = InternalEvent.New() | |
413 | init.OnHitHumanoid = InternalEvent.New() | |
414 | init.OnAttackReady = InternalEvent.New() | |
415 | init.OnAttack = InternalEvent.New() | |
416 | ||
417 | return init | |
418 | end | |
419 | ||
420 | function SwordPart:SwordTouch(hit) | |
421 | if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end | |
422 | self.OnHit:Fire(hit) | |
423 | local character,humanoid = UTIL.FindCharacterAncestor(hit) | |
424 | if character and character ~= self.Owner.Character then | |
425 | humanoid:TakeDamage(self.Damage) | |
426 | self.OnHitHumanoid:Fire(humanoid,hit) | |
427 | self.LastHit = tick() | |
428 | if self.HitSound then | |
429 | self.HitSound:Play() | |
430 | end | |
431 | end | |
432 | ||
433 | end | |
434 | ||
435 | function SwordPart:DoSwing() | |
436 | if tick()-self.LastSwing<self.AttackTime+self.CoolDown then | |
437 | return | |
438 | end | |
439 | ||
440 | if self.SwingAnimation then | |
441 | self.SwingAnimation:Play(.1,1,1.5) | |
442 | end | |
443 | if self.SwingSound then | |
444 | self.SwingSound:Play() | |
445 | end | |
446 | self.LastSwing = tick() | |
447 | self.OnAttack:Fire() | |
448 | end | |
449 | ||
450 | function SwordPart:Destroy() | |
451 | for _,i in pairs(self.ActiveConnections) do | |
452 | i:disconnect() | |
453 | end | |
454 | end | |
455 | end | |
456 | do | |
457 | local Handle = script.Parent | |
458 | local Tool = Handle.Parent | |
459 | ||
460 | local Player = game.Players.LocalPlayer | |
461 | local Character = UTIL.WaitForValidCharacter(Player) | |
462 | local SwingAni = UTIL.Instantiate"Animation" | |
463 | {AnimationId = "http://www.roblox.com/Asset?ID=89289879"} | |
464 | ||
465 | local HitSound = Handle:WaitForChild('Hit') | |
466 | local SwingSound = Handle:WaitForChild('Swing') | |
467 | ||
468 | local SwingAniTrack | |
469 | ||
470 | local Sword | |
471 | ||
472 | ||
473 | Tool.Equipped:connect(function(mouse) | |
474 | Sword = SwordPart.New(Handle,Player) | |
475 | Sword.Damage = 40 | |
476 | Sword.HitSound = HitSound | |
477 | Sword.SwingSound = SwingSound | |
478 | Character = UTIL.WaitForValidCharacter(Player) | |
479 | local Humanoid = Character:FindFirstChild('Humanoid') | |
480 | ||
481 | SwingAniTrack = Humanoid:LoadAnimation(SwingAni) | |
482 | Sword.SwingAnimation = SwingAniTrack | |
483 | ||
484 | Sword.OnHitHumanoid:Connect(function(humanoid,hit) | |
485 | local myTorso = Character:FindFirstChild('Torso') | |
486 | local torso = humanoid.Parent:FindFirstChild('Torso') | |
487 | if not torso or not myTorso then return end | |
488 | ||
489 | if hit.Name=='Right Arm' or hit.Name=='Left Arm' or hit.Name=='Right Leg' or hit.Name=='Left Leg' then | |
490 | hit:BreakJoints() | |
491 | WeldUtil.WeldBetween(hit, Handle) | |
492 | Delay(1,function() hit:BreakJoints() end ) | |
493 | end | |
494 | end) | |
495 | ||
496 | mouse.Button1Down:connect(function() | |
497 | Sword:DoSwing() | |
498 | end) | |
499 | end) | |
500 | Tool.Unequipped:connect(function() | |
501 | Sword:Destroy() | |
502 | end) | |
503 | ||
504 | end | |
505 | ||
506 | end)) | |
507 | Sound4.Name = "Hit" | |
508 | Sound4.Parent = Part2 | |
509 | Sound4.Pitch = 0.69999998807907 | |
510 | Sound4.SoundId = "http://www.roblox.com/Asset?ID=123252378" | |
511 | Sound4.Volume = 1 | |
512 | Sound5.Name = "Swing" | |
513 | Sound5.Parent = Part2 | |
514 | Sound5.SoundId = "rbxasset://sounds/swordslash.wav" | |
515 | Sound5.Volume = 1 | |
516 | Animation6.Name = "Idle" | |
517 | Animation6.Parent = Part2 | |
518 | Animation6.AnimationId = "http://www.roblox.com/Asset?ID=75522566" | |
519 | SpecialMesh7.Parent = Part2 | |
520 | SpecialMesh7.MeshId = "http://www.roblox.com/asset/?id=123248347" | |
521 | SpecialMesh7.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006) | |
522 | SpecialMesh7.TextureId = "http://www.roblox.com/asset/?id=123248449" | |
523 | SpecialMesh7.MeshType = Enum.MeshType.FileMesh | |
524 | SpecialMesh7.Scale = Vector3.new(0.400000006, 0.400000006, 0.400000006) | |
525 | Script8.Name = "qPerfectionWeld" | |
526 | Script8.Parent = Tool0 | |
527 | table.insert(cors,sandbox(Script8,function() | |
528 | ||
529 | ||
530 | 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). | |
531 | ||
532 | ||
533 | local function CallOnChildren(Instance, FunctionToCall) | |
534 | -- Calls a function on each of the children of a certain object, using recursion. | |
535 | ||
536 | FunctionToCall(Instance) | |
537 | ||
538 | for _, Child in next, Instance:GetChildren() do | |
539 | CallOnChildren(Child, FunctionToCall) | |
540 | end | |
541 | end | |
542 | ||
543 | local function GetNearestParent(Instance, ClassName) | |
544 | -- Returns the nearest parent of a certain class, or returns nil | |
545 | ||
546 | local Ancestor = Instance | |
547 | repeat | |
548 | Ancestor = Ancestor.Parent | |
549 | if Ancestor == nil then | |
550 | return nil | |
551 | end | |
552 | until Ancestor:IsA(ClassName) | |
553 | ||
554 | return Ancestor | |
555 | end | |
556 | ||
557 | local function GetBricks(StartInstance) | |
558 | local List = {} | |
559 | ||
560 | -- if StartInstance:IsA("BasePart") then | |
561 | -- List[#List+1] = StartInstance | |
562 | -- end | |
563 | ||
564 | CallOnChildren(StartInstance, function(Item) | |
565 | if Item:IsA("BasePart") then | |
566 | List[#List+1] = Item; | |
567 | end | |
568 | end) | |
569 | ||
570 | return List | |
571 | end | |
572 | ||
573 | local function Modify(Instance, Values) | |
574 | -- Modifies an Instance by using a table. | |
575 | ||
576 | assert(type(Values) == "table", "Values is not a table"); | |
577 | ||
578 | for Index, Value in next, Values do | |
579 | if type(Index) == "number" then | |
580 | Value.Parent = Instance | |
581 | else | |
582 | Instance[Index] = Value | |
583 | end | |
584 | end | |
585 | return Instance | |
586 | end | |
587 | ||
588 | local function Make(ClassType, Properties) | |
589 | -- Using a syntax hack to create a nice way to Make new items. | |
590 | ||
591 | return Modify(Instance.new(ClassType), Properties) | |
592 | end | |
593 | ||
594 | local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"} | |
595 | local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"} | |
596 | ||
597 | local function HasWheelJoint(Part) | |
598 | for _, SurfaceName in pairs(Surfaces) do | |
599 | for _, HingSurfaceName in pairs(HingSurfaces) do | |
600 | if Part[SurfaceName].Name == HingSurfaceName then | |
601 | return true | |
602 | end | |
603 | end | |
604 | end | |
605 | ||
606 | return false | |
607 | end | |
608 | ||
609 | local function ShouldBreakJoints(Part) | |
610 | --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are | |
611 | -- definitely some edge cases. | |
612 | ||
613 | if NEVER_BREAK_JOINTS then | |
614 | return false | |
615 | end | |
616 | ||
617 | if HasWheelJoint(Part) then | |
618 | return false | |
619 | end | |
620 | ||
621 | local Connected = Part:GetConnectedParts() | |
622 | ||
623 | if #Connected == 1 then | |
624 | return false | |
625 | end | |
626 | ||
627 | for _, Item in pairs(Connected) do | |
628 | if HasWheelJoint(Item) then | |
629 | return false | |
630 | elseif not Item:IsDescendantOf(script.Parent) then | |
631 | return false | |
632 | end | |
633 | end | |
634 | ||
635 | return true | |
636 | end | |
637 | ||
638 | local function WeldTogether(Part0, Part1, JointType, WeldParent) | |
639 | ||
640 | ||
641 | JointType = JointType or "Weld" | |
642 | local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue") | |
643 | ||
644 | local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType) | |
645 | Modify(NewWeld, { | |
646 | Name = "qCFrameWeldThingy"; | |
647 | Part0 = Part0; | |
648 | Part1 = Part1; | |
649 | C0 = CFrame.new();--Part0.CFrame:inverse(); | |
650 | C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse(); | |
651 | Parent = Part1; | |
652 | }) | |
653 | ||
654 | if not RelativeValue then | |
655 | RelativeValue = Make("CFrameValue", { | |
656 | Parent = Part1; | |
657 | Name = "qRelativeCFrameWeldValue"; | |
658 | Archivable = true; | |
659 | Value = NewWeld.C1; | |
660 | }) | |
661 | end | |
662 | ||
663 | return NewWeld | |
664 | end | |
665 | ||
666 | local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor) | |
667 | ||
668 | ||
669 | for _, Part in pairs(Parts) do | |
670 | if ShouldBreakJoints(Part) then | |
671 | Part:BreakJoints() | |
672 | end | |
673 | end | |
674 | ||
675 | for _, Part in pairs(Parts) do | |
676 | if Part ~= MainPart then | |
677 | WeldTogether(MainPart, Part, JointType, MainPart) | |
678 | end | |
679 | end | |
680 | ||
681 | if not DoNotUnanchor then | |
682 | for _, Part in pairs(Parts) do | |
683 | Part.Anchored = false | |
684 | end | |
685 | MainPart.Anchored = false | |
686 | end | |
687 | end | |
688 | ||
689 | local function PerfectionWeld() | |
690 | local Tool = GetNearestParent(script, "Tool") | |
691 | ||
692 | local Parts = GetBricks(script.Parent) | |
693 | 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] | |
694 | ||
695 | if PrimaryPart then | |
696 | WeldParts(Parts, PrimaryPart, "Weld", false) | |
697 | else | |
698 | warn("qWeld - Unable to weld part") | |
699 | end | |
700 | ||
701 | return Tool | |
702 | end | |
703 | ||
704 | local Tool = PerfectionWeld() | |
705 | ||
706 | ||
707 | if Tool and script.ClassName == "Script" then | |
708 | --- Don't bother with local scripts | |
709 | ||
710 | script.Parent.AncestryChanged:connect(function() | |
711 | PerfectionWeld() | |
712 | end) | |
713 | end | |
714 | ||
715 | ||
716 | end)) | |
717 | LocalScript9.Name = "Arms" | |
718 | LocalScript9.Parent = Tool0 | |
719 | table.insert(cors,sandbox(LocalScript9,function() | |
720 | Tool = script.Parent | |
721 | local arms = nil | |
722 | local torso = nil | |
723 | local fakearms = {} | |
724 | local welds = {} | |
725 | ||
726 | function Equip(mouse) | |
727 | wait(0.01) | |
728 | arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")} | |
729 | torso = Tool.Parent:FindFirstChild("Torso") | |
730 | model = Instance.new("Model", workspace) | |
731 | model.Name = "Arms" | |
732 | humanoid = Instance.new("Humanoid", model) | |
733 | humanoid.Name = "ArmHumanoid" | |
734 | local Link = Instance.new("ObjectValue",model) | |
735 | Link.Name, Link.Value = "HumanoidLink", torso.Parent.Humanoid | |
736 | if Tool.Parent:FindFirstChild("Shirt") then | |
737 | Tool.Parent.Shirt:Clone().Parent = model | |
738 | end | |
739 | for n,v in ipairs(arms) do | |
740 | local P = v:Clone() | |
741 | P.Parent = model | |
742 | P.TopSurface, P.BottomSurface = "Smooth", "Smooth" | |
743 | local PW = Instance.new("Weld") | |
744 | PW.Name = "FakeArmWeld" | |
745 | PW.Parent = v | |
746 | PW.Part0, PW.Part1, PW.C0, PW.C1 = v, P, v.CFrame:inverse(), P.CFrame:inverse() | |
747 | v.Transparency = 1 | |
748 | fakearms[n] = P | |
749 | end | |
750 | fakearms[2].RightGrip:Destroy() | |
751 | mouse.TargetFilter = model | |
752 | end | |
753 | ||
754 | function Unequip(mouse) | |
755 | model:Destroy() | |
756 | for n,v in ipairs(arms) do | |
757 | v.Transparency = 0 | |
758 | end | |
759 | end | |
760 | ||
761 | Tool.Equipped:connect(Equip) | |
762 | Tool.Unequipped:connect(Unequip) | |
763 | ||
764 | end)) | |
765 | LocalScript10.Name = "Weld" | |
766 | LocalScript10.Parent = Tool0 | |
767 | table.insert(cors,sandbox(LocalScript10,function() | |
768 | ||
769 | function Weld(x,y) | |
770 | local W = Instance.new("Weld") | |
771 | W.Part0 = x | |
772 | W.Part1 = y | |
773 | local CJ = CFrame.new(x.Position) | |
774 | local C0 = x.CFrame:inverse()*CJ | |
775 | local C1 = y.CFrame:inverse()*CJ | |
776 | W.C0 = C0 | |
777 | W.C1 = C1 | |
778 | W.Parent = x | |
779 | end | |
780 | ||
781 | function SimpleWeld(x,y) | |
782 | local W = Instance.new("Weld") | |
783 | W.Part0 = x | |
784 | W.Part1 = y | |
785 | W.Parent = x | |
786 | end | |
787 | ||
788 | function Get(A) | |
789 | if A:IsA("BasePart") then | |
790 | if A.Name == "HammerRotation" then | |
791 | SimpleWeld(script.Parent.HammerAttachment, A) | |
792 | A.Anchored = false | |
793 | elseif A.Name == "Hammer" then | |
794 | Weld(script.Parent.HammerRotation, A) | |
795 | A.Anchored = false | |
796 | elseif A.Name == "FrizzenRotation" then | |
797 | SimpleWeld(script.Parent.FrizzenAttachment, A) | |
798 | A.Anchored = false | |
799 | elseif A.Name == "Frizzen" then | |
800 | Weld(script.Parent.FrizzenRotation, A) | |
801 | A.Anchored = false | |
802 | else | |
803 | Weld(script.Parent.Handle, A) | |
804 | A.Anchored = false | |
805 | end | |
806 | else | |
807 | local C = A:GetChildren() | |
808 | for i=1, #C do | |
809 | Get(C[i]) | |
810 | end | |
811 | end | |
812 | end | |
813 | ||
814 | function Finale() | |
815 | Get(script.Parent) | |
816 | end | |
817 | ||
818 | ||
819 | end)) | |
820 | Part11.Name = "Grip" | |
821 | Part11.Parent = Tool0 | |
822 | Part11.Material = Enum.Material.Wood | |
823 | Part11.BrickColor = BrickColor.new("Pine Cone") | |
824 | Part11.Rotation = Vector3.new(-180, 0, -180) | |
825 | Part11.CanCollide = false | |
826 | Part11.FormFactor = Enum.FormFactor.Custom | |
827 | Part11.Size = Vector3.new(0.249733165, 0.249733493, 0.249733463) | |
828 | Part11.CFrame = CFrame.new(-8.40885925, 3.84257984, -83.8658752, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
829 | Part11.BottomSurface = Enum.SurfaceType.Smooth | |
830 | Part11.TopSurface = Enum.SurfaceType.Smooth | |
831 | Part11.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
832 | Part11.Position = Vector3.new(-8.40885925, 3.84257984, -83.8658752) | |
833 | Part11.Orientation = Vector3.new(0, 180, 0) | |
834 | Part11.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
835 | CylinderMesh12.Parent = Part11 | |
836 | CylinderMesh12.Scale = Vector3.new(0.947650433, 0.0557441823, 0.947649717) | |
837 | CylinderMesh12.Scale = Vector3.new(0.947650433, 0.0557441823, 0.947649717) | |
838 | Part13.Name = "Wood" | |
839 | Part13.Parent = Tool0 | |
840 | Part13.Material = Enum.Material.Wood | |
841 | Part13.BrickColor = BrickColor.new("Pine Cone") | |
842 | Part13.CanCollide = false | |
843 | Part13.FormFactor = Enum.FormFactor.Custom | |
844 | Part13.Size = Vector3.new(0.249733165, 1.12017298, 0.249733463) | |
845 | Part13.CFrame = CFrame.new(-8.40727234, 3.08049679, -83.8654633, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
846 | Part13.BottomSurface = Enum.SurfaceType.Smooth | |
847 | Part13.TopSurface = Enum.SurfaceType.Smooth | |
848 | Part13.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
849 | Part13.Position = Vector3.new(-8.40727234, 3.08049679, -83.8654633) | |
850 | Part13.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
851 | Weld14.Parent = Part13 | |
852 | Weld14.C0 = CFrame.new(0, 0, 0, 1.10826505e-07, -1, 1.24278703e-08, 2.08616228e-07, -1.24278472e-08, -1, 1, 1.10826505e-07, 2.08616228e-07) | |
853 | Weld14.C1 = CFrame.new(0, 0, 0, 1.10826505e-07, -1, 1.24278703e-08, 2.08616228e-07, -1.24278472e-08, -1, 1, 1.10826505e-07, 2.08616228e-07) | |
854 | CylinderMesh15.Parent = Part13 | |
855 | CylinderMesh15.Scale = Vector3.new(0.869548976, 1, 0.869550526) | |
856 | CylinderMesh15.Scale = Vector3.new(0.869548976, 1, 0.869550526) | |
857 | Part16.Name = "Metal" | |
858 | Part16.Parent = Tool0 | |
859 | Part16.Material = Enum.Material.Wood | |
860 | Part16.BrickColor = BrickColor.new("Beige") | |
861 | Part16.Rotation = Vector3.new(0, -90, 0) | |
862 | Part16.CanCollide = false | |
863 | Part16.FormFactor = Enum.FormFactor.Custom | |
864 | Part16.Size = Vector3.new(0.249733165, 2.88074279, 0.249733463) | |
865 | Part16.CFrame = CFrame.new(-8.40756989, 4.19514513, -83.8649292, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
866 | Part16.BottomSurface = Enum.SurfaceType.Smooth | |
867 | Part16.TopSurface = Enum.SurfaceType.Smooth | |
868 | Part16.Color = Color3.new(0.792157, 0.74902, 0.639216) | |
869 | Part16.Position = Vector3.new(-8.40756989, 4.19514513, -83.8649292) | |
870 | Part16.Orientation = Vector3.new(0, -90, 0) | |
871 | Part16.Color = Color3.new(0.792157, 0.74902, 0.639216) | |
872 | CylinderMesh17.Parent = Part16 | |
873 | CylinderMesh17.Scale = Vector3.new(0.800000012, 0.995999992, 0.800000012) | |
874 | CylinderMesh17.Scale = Vector3.new(0.800000012, 0.995999992, 0.800000012) | |
875 | Part18.Name = "Metal" | |
876 | Part18.Parent = Tool0 | |
877 | Part18.Material = Enum.Material.Wood | |
878 | Part18.BrickColor = BrickColor.new("Pine Cone") | |
879 | Part18.Rotation = Vector3.new(0, -90, 0) | |
880 | Part18.CanCollide = false | |
881 | Part18.FormFactor = Enum.FormFactor.Custom | |
882 | Part18.Size = Vector3.new(0.249733165, 2.88074279, 0.249733463) | |
883 | Part18.CFrame = CFrame.new(-8.40756989, 4.1851449, -83.8649292, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
884 | Part18.BottomSurface = Enum.SurfaceType.Smooth | |
885 | Part18.TopSurface = Enum.SurfaceType.Smooth | |
886 | Part18.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
887 | Part18.Position = Vector3.new(-8.40756989, 4.1851449, -83.8649292) | |
888 | Part18.Orientation = Vector3.new(0, -90, 0) | |
889 | Part18.Color = Color3.new(0.423529, 0.345098, 0.294118) | |
890 | CylinderMesh19.Parent = Part18 | |
891 | CylinderMesh19.Scale = Vector3.new(0.907233477, 1, 0.85386616) | |
892 | CylinderMesh19.Scale = Vector3.new(0.907233477, 1, 0.85386616) | |
893 | LocalScript20.Name = "Remove Mouse" | |
894 | LocalScript20.Parent = Tool0 | |
895 | table.insert(cors,sandbox(LocalScript20,function() | |
896 | local mouse = game.Players.LocalPlayer:GetMouse() | |
897 | mouse.Icon = 'rbxassetid://35446049' | |
898 | end)) | |
899 | for i,v in pairs(mas:GetChildren()) do | |
900 | v.Parent = game:GetService("Players").LocalPlayer.Backpack | |
901 | pcall(function() v:MakeJoints() end) | |
902 | end | |
903 | mas:Destroy() | |
904 | for i,v in pairs(cors) do | |
905 | spawn(function() | |
906 | pcall(v) | |
907 | end) | |
908 | end |