SHOW:
|
|
- or go back to the newest paste.
| 1 | MainColor = "Bright red" | |
| 2 | - | Name = "KeroroGunso2016" |
| 2 | + | Name = "overhaleren" |
| 3 | ||
| 4 | Plrs = game:GetService("Players")
| |
| 5 | ||
| 6 | me = Plrs[Name] | |
| 7 | char = me.Character | |
| 8 | Modelname = "xTool" | |
| 9 | Toolname = "Tool" | |
| 10 | Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
| |
| 11 | necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 12 | selected = false | |
| 13 | Hurt = false | |
| 14 | Deb = true | |
| 15 | Able = true | |
| 16 | Prop = {Damage = 30}
| |
| 17 | ||
| 18 | ToolIcon = "" | |
| 19 | MouseIc = "" | |
| 20 | MouseDo = "" | |
| 21 | ||
| 22 | Add = {
| |
| 23 | Sphere = function(P) | |
| 24 | local m = Instance.new("SpecialMesh",P)
| |
| 25 | m.MeshType = "Sphere" | |
| 26 | return m | |
| 27 | end, | |
| 28 | BF = function(P) | |
| 29 | local bf = Instance.new("BodyForce",P)
| |
| 30 | bf.force = Vector3.new(0, P:GetMass()*187, 0) | |
| 31 | return bf | |
| 32 | end, | |
| 33 | BP = function(P) | |
| 34 | local bp = Instance.new("BodyPosition",P)
| |
| 35 | bp.maxForce = Vector3.new(math.huge, 0, math.huge) | |
| 36 | bp.P = 14000 | |
| 37 | return bp | |
| 38 | end, | |
| 39 | BG = function(P) | |
| 40 | local bg = Instance.new("BodyGyro",P)
| |
| 41 | bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge) | |
| 42 | bg.P = 14000 | |
| 43 | return bg | |
| 44 | end, | |
| 45 | Mesh = function(P, ID, x, y, z) | |
| 46 | local m = Instance.new("SpecialMesh")
| |
| 47 | m.MeshId = ID | |
| 48 | m.Scale = Vector3.new(x, y, z) | |
| 49 | m.Parent = P | |
| 50 | return m | |
| 51 | end, | |
| 52 | Sound = function(P, ID, vol, pitch) | |
| 53 | local s = Instance.new("Sound")
| |
| 54 | s.SoundId = ID | |
| 55 | s.Volume = vol | |
| 56 | s.Pitch = pitch | |
| 57 | s.Parent = P | |
| 58 | return s | |
| 59 | end | |
| 60 | } | |
| 61 | ||
| 62 | function find(tab, arg) | |
| 63 | local ah = nil | |
| 64 | for i,v in pairs(tab) do | |
| 65 | if v == arg then | |
| 66 | ah = v | |
| 67 | end | |
| 68 | end | |
| 69 | return ah | |
| 70 | end | |
| 71 | ||
| 72 | function getAllParts(from) | |
| 73 | local t = {}
| |
| 74 | function getParts(where) | |
| 75 | for i, v in pairs(where:children()) do | |
| 76 | if v:IsA("BasePart") then
| |
| 77 | if v.Parent ~= char and v.Parent.Parent ~= char then | |
| 78 | table.insert(t, v) | |
| 79 | end | |
| 80 | end | |
| 81 | getParts(v) | |
| 82 | end | |
| 83 | end | |
| 84 | getParts(workspace) | |
| 85 | return t | |
| 86 | end | |
| 87 | ||
| 88 | function RayCast(pos1, pos2, maxDist, forward) | |
| 89 | local list = getAllParts(workspace) | |
| 90 | local pos0 = pos1 | |
| 91 | for dist = 1, maxDist, forward do | |
| 92 | pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p | |
| 93 | for _, v in pairs(list) do | |
| 94 | local pos3 = v.CFrame:pointToObjectSpace(pos0) | |
| 95 | local s = v.Size | |
| 96 | if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then | |
| 97 | return pos0, v | |
| 98 | end | |
| 99 | end | |
| 100 | end | |
| 101 | return pos0, nil | |
| 102 | end | |
| 103 | ||
| 104 | function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break) | |
| 105 | local p = Instance.new("Part")
| |
| 106 | p.formFactor = "Custom" | |
| 107 | p.Anchored = Anchor | |
| 108 | p.CanCollide = Collide | |
| 109 | p.Transparency = Tran | |
| 110 | p.Reflectance = Ref | |
| 111 | p.BrickColor = BrickColor.new(Color) | |
| 112 | for _, Surf in pairs(Surfaces) do | |
| 113 | p[Surf] = "Smooth" | |
| 114 | end | |
| 115 | p.Size = Vector3.new(X, Y, Z) | |
| 116 | if Break then | |
| 117 | p:BreakJoints() | |
| 118 | else p:MakeJoints() end | |
| 119 | p.Parent = Parent | |
| 120 | return p | |
| 121 | end | |
| 122 | ||
| 123 | function Weld(p0, p1, x, y, z, a, b, c) | |
| 124 | local w = Instance.new("Weld")
| |
| 125 | w.Parent = p0 | |
| 126 | w.Part0 = p0 | |
| 127 | w.Part1 = p1 | |
| 128 | w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c) | |
| 129 | return w | |
| 130 | end | |
| 131 | ||
| 132 | function ComputePos(pos1, pos2) | |
| 133 | local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z) | |
| 134 | return CFrame.new(pos1, pos3) | |
| 135 | end | |
| 136 | ||
| 137 | function getHumanoid(c) | |
| 138 | local h = nil | |
| 139 | for i,v in pairs(c:children()) do | |
| 140 | if v:IsA("Humanoid") and c ~= char then
| |
| 141 | if v.Health > 0 then | |
| 142 | h = v | |
| 143 | end | |
| 144 | end | |
| 145 | end | |
| 146 | return h | |
| 147 | end | |
| 148 | ||
| 149 | for i,v in pairs(char:children()) do | |
| 150 | if v.Name == Modelname then | |
| 151 | v:remove() | |
| 152 | end | |
| 153 | end | |
| 154 | ||
| 155 | torso = char.Torso | |
| 156 | neck = torso.Neck | |
| 157 | hum = char.Humanoid | |
| 158 | Rarm = char["Right Arm"] | |
| 159 | Larm = char["Left Arm"] | |
| 160 | Rleg = char["Right Leg"] | |
| 161 | Lleg = char["Left Leg"] | |
| 162 | ||
| 163 | hc = Instance.new("Humanoid")
| |
| 164 | hc.Health = 0 | |
| 165 | hc.MaxHealth = 0 | |
| 166 | ||
| 167 | slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8) | |
| 168 | hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6) | |
| 169 | charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65) | |
| 170 | boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3) | |
| 171 | smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35) | |
| 172 | boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18) | |
| 173 | ||
| 174 | function PlaySound(sound, pitch, vol) | |
| 175 | local s = sound:clone() | |
| 176 | if pitch ~= nil then | |
| 177 | if tonumber(pitch) then | |
| 178 | s.Pitch = tonumber(pitch) | |
| 179 | end | |
| 180 | end | |
| 181 | if vol ~= nil then | |
| 182 | if tonumber(vol) then | |
| 183 | s.Volume = tonumber(vol) | |
| 184 | end | |
| 185 | end | |
| 186 | s.Parent = torso | |
| 187 | s.PlayOnRemove = true | |
| 188 | coroutine.resume(coroutine.create(function() | |
| 189 | wait() | |
| 190 | s:remove() | |
| 191 | end)) | |
| 192 | end | |
| 193 | ||
| 194 | Mo = Instance.new("Model")
| |
| 195 | Mo.Name = Modelname | |
| 196 | ||
| 197 | RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 198 | LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 199 | RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 200 | LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 201 | ||
| 202 | RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0) | |
| 203 | LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0) | |
| 204 | RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0) | |
| 205 | LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0) | |
| 206 | ||
| 207 | RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0) | |
| 208 | LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0) | |
| 209 | RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0) | |
| 210 | LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0) | |
| 211 | ||
| 212 | HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 213 | HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0) | |
| 214 | HW = Weld(HB, nil, 0, -1.3, 0, math.pi/2, 0, 0) | |
| 215 | ||
| 216 | TH = Weld(torso, nil, -0.8, 0.4, -0.4, 0, math.pi/2, math.rad(80)) | |
| 217 | ||
| 218 | RAWStand, LAWStand, RLWStand, LLWStand, HWStand = nil | |
| 219 | ||
| 220 | handle = Part(Mo, false, false, 0, 0, GuitarColour, 0.6, 1.5, 1.5, true) | |
| 221 | handle.Name = "Handle" | |
| 222 | ||
| 223 | Mo.Parent = char | |
| 224 | TH.Part1 = handle | |
| 225 | ||
| 226 | if script.Parent.className ~= "HopperBin" then | |
| 227 | h = Instance.new("HopperBin",me.Backpack)
| |
| 228 | h.Name = Toolname | |
| 229 | h.TextureId = ToolIcon | |
| 230 | script.Parent = h | |
| 231 | end | |
| 232 | ||
| 233 | bin = script.Parent | |
| 234 | ||
| 235 | function detach(bool) | |
| 236 | LLW.C0 = CFrame.new(0, 0, 0) | |
| 237 | RLW.C0 = CFrame.new(0, 0, 0) | |
| 238 | LAW.C0 = CFrame.new(0,0,0) | |
| 239 | RAW.C0 = CFrame.new(0, 0, 0) | |
| 240 | if bool then | |
| 241 | LLW.Part1 = nil | |
| 242 | RLW.Part1 = nil | |
| 243 | RAW.Part1 = nil | |
| 244 | LAW.Part1 = nil | |
| 245 | end | |
| 246 | end | |
| 247 | ||
| 248 | function attach() | |
| 249 | RAW.Part1 = Rarm | |
| 250 | LAW.Part1 = Larm | |
| 251 | RLW.Part1 = Rleg | |
| 252 | LLW.Part1 = Lleg | |
| 253 | end | |
| 254 | ||
| 255 | function normal() | |
| 256 | neck.C0 = NeckStand | |
| 257 | RAW.C0 = RAWStand | |
| 258 | LAW.C0 = LAWStand | |
| 259 | RLW.C0 = RLWStand | |
| 260 | LLW.C0 = LLWStand | |
| 261 | RAW.C1 = CFrame.new(0, 0.5, 0) | |
| 262 | LAW.C1 = CFrame.new(0, 0.5, 0) | |
| 263 | RLW.C1 = CFrame.new(0, 0.8, 0) | |
| 264 | LLW.C1 = CFrame.new(0, 0.8, 0) | |
| 265 | HW.C0 = HWStand | |
| 266 | end | |
| 267 | ||
| 268 | function idleanim() | |
| 269 | attach() | |
| 270 | for i = 0, 1, 0.03 do | |
| 271 | RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0) | |
| 272 | LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0) | |
| 273 | RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0) | |
| 274 | LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0) | |
| 275 | neck.C0 = NeckStand * CFrame.Angles(0, 0, 0) | |
| 276 | if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end | |
| 277 | wait() | |
| 278 | end | |
| 279 | wait() | |
| 280 | for i = 1, 0, -0.02 do | |
| 281 | RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0) | |
| 282 | LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0) | |
| 283 | RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0) | |
| 284 | LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0) | |
| 285 | neck.C0 = NeckStand * CFrame.Angles(0, 0, 0) | |
| 286 | if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end | |
| 287 | wait() | |
| 288 | end | |
| 289 | normal() | |
| 290 | end | |
| 291 | ||
| 292 | function runanim() | |
| 293 | RLW.Part1 = nil | |
| 294 | LLW.Part1 = nil | |
| 295 | end | |
| 296 | ||
| 297 | coroutine.resume(coroutine.create(function() | |
| 298 | while true do | |
| 299 | wait() | |
| 300 | if selected and Able == true then | |
| 301 | if torso.Velocity.magnitude < 2 then | |
| 302 | --idleanim() | |
| 303 | wait() | |
| 304 | else | |
| 305 | --runanim() | |
| 306 | wait() | |
| 307 | end | |
| 308 | end | |
| 309 | end | |
| 310 | end)) | |
| 311 | ||
| 312 | function selectanim() | |
| 313 | attach() | |
| 314 | if RAWStand == nil then | |
| 315 | RAWStand = RAW.C0 | |
| 316 | LAWStand = LAW.C0 | |
| 317 | RLWStand = RLW.C0 | |
| 318 | LLWStand = LLW.C0 | |
| 319 | HWStand = HW.C0 | |
| 320 | end | |
| 321 | normal() | |
| 322 | end | |
| 323 | ||
| 324 | function deselanim() | |
| 325 | neck.C0 = necko | |
| 326 | detach(true) | |
| 327 | end | |
| 328 | ||
| 329 | function select(mouse) | |
| 330 | selectanim() | |
| 331 | selected = true | |
| 332 | mouse.KeyDown:connect(function(key) | |
| 333 | key = key:lower() | |
| 334 | end) | |
| 335 | mouse.Button1Down:connect(function() | |
| 336 | end) | |
| 337 | end | |
| 338 | ||
| 339 | function deselect(mouse) | |
| 340 | selected = false | |
| 341 | deselanim() | |
| 342 | end | |
| 343 | ||
| 344 | bin.Selected:connect(select) | |
| 345 | bin.Deselected:connect(deselect) |