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