Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rad = math.rad
- local rand = math.random
- function makeJoints(model)
- for _,v in pairs(model:GetChildren()) do
- if v:IsA("BasePart") then
- v:MakeJoints()
- v.Anchored = false
- v.CanCollide = false
- else
- makeJoints(v)
- end
- end
- end
- local rightArmJoint = Instance.new("Weld", rightArm)
- rightArmJoint.Part0 = nil
- rightArmJoint.Part1 = torso
- rightArmJoint.C0 = cf(-((torso.Size.X/2) + (rightArm.Size.X/2)),0,0)*angles(0,0,0)
- local rightArmOriginCF = cf(-((torso.Size.X/2) + (rightArm.Size.X/2)),0,0)*angles(0,0,0)
- local rightArmTargetCF = rightArmOriginCF
- local rightArmHoldCF = rightArmOriginCF*angles(rad(-90), 0, 0)*cf(0, -0.5, 0.5)
- local leftArmJoint = Instance.new("Weld", leftArm)
- leftArmJoint.Part0 = nil
- leftArmJoint.Part1 = torso
- leftArmJoint.C0 = cf((torso.Size.X/2)+(leftArm.Size.X/2),0,0)*angles(0,0,0)
- local leftArmOriginCF = cf((torso.Size.X/2)+(leftArm.Size.X/2),0,0)*angles(0,0,0)
- local leftArmTargetCF = leftArmOriginCF
- local leftArmHoldCF = leftArmOriginCF*angles(rad(-90), 0, 0)*cf(0, -0.5, 0.5)
- local rightLegJoint = Instance.new("Weld", rightLeg)
- rightLegJoint.Part0 = nil
- rightLegJoint.Part1 = torso
- rightLegJoint.C0 = cf(0, ((torso.Size.Y/2)+(rightLeg.Size.Y/2)), 0)*angles(0,0,0)
- local rightLegOriginCF = cf(-(torso.Size.X/2) + rightLeg.Size.X/2, ((torso.Size.Y/2)+(rightLeg.Size.Y/2)), 0)*angles(0,0,0)
- local rightLegTargetCF = rightLegOriginCF
- local leftLegJoint = Instance.new("Weld", leftLeg)
- leftLegJoint.Part0 = nil
- leftLegJoint.Part1 = torso
- leftLegJoint.C0 = cf(0, ((torso.Size.Y/2)+(leftLeg.Size.Y/2)), 0)*angles(0,0,0)
- local leftLegOriginCF = cf((torso.Size.X/2) - leftLeg.Size.X/2, ((torso.Size.Y/2)+(leftLeg.Size.Y/2)), 0)*angles(0,0,0)
- local leftLegTargetCF = leftLegOriginCF
- game:GetService("RunService").RenderStepped:connect(function()
- leftArmJoint.C0 = leftArmJoint.C0:lerp(leftArmTargetCF, 0.1)
- rightArmJoint.C0 = rightArmJoint.C0:lerp(rightArmTargetCF, 0.1)
- rightLegJoint.C0 = rightLegJoint.C0:lerp(rightLegTargetCF, 0.1)
- leftLegJoint.C0 = leftLegJoint.C0:lerp(leftLegTargetCF, 0.1)
- end)
- local currentSide = 1
- function weldBetween(p0, p1)
- local weld = Instance.new("Weld")
- weld.Part0 = p0
- weld.Part1 = p1
- weld.C0 = p0.CFrame:inverse()
- weld.C1 = p1.CFrame:inverse()
- weld.Parent = p0
- end
- function weldModel(model, pp)
- for _,v in pairs(model:GetChildren()) do
- if v:IsA("BasePart") then
- local weld = Instance.new("Weld")
- weld.Part0 = pp
- weld.Part1 = v
- weld.C0 = pp.CFrame:inverse()
- weld.C1 = v.CFrame:inverse()
- weld.Parent = pp
- end
- end
- end
- function scan(obj)
- obj:BreakJoints()
- for _,v in pairs(obj:GetChildren()) do
- if v:IsA("BasePart") then
- v.Anchored = false
- v.CanCollide = false
- else
- scan(v)
- end
- end
- end
- function surfaceChange(part)
- part.TopSurface = 10
- part.BottomSurface = 10
- part.FrontSurface = 10
- part.BackSurface = 10
- part.RightSurface = 10
- part.LeftSurface = 10
- end
- function createPistol()
- local model = Instance.new("Model", char)
- model.Name = "Pistol"
- local mag = Instance.new("Model", model)
- mag.Name = "Mag"
- local m1 = Instance.new("Part", mag)
- m1.Name = "Part"
- m1.Size = Vector3.new(0.200000003, 0.200000003, 0.323524684)
- m1.CFrame = CFrame.new(-11.2802582, 0.178448141, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- m1.Anchored = false
- m1.CanCollide = false
- m1.BrickColor = BrickColor.new("White")
- surfaceChange(m1)
- local m2 = Instance.new("Part", mag)
- m2.Name = "Part"
- m2.Size = Vector3.new(0.647049308, 0.200000003, 0.323524684)
- m2.CFrame = CFrame.new(-11.5902891, 0.13587451, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- m2.Anchored = false
- m2.CanCollide = false
- m2.BrickColor = BrickColor.new("White")
- surfaceChange(m2)
- local m3 = Instance.new("Part", mag)
- m3.Name = "Part"
- m3.Size = Vector3.new(0.307348371, 0.200000003, 0.323524684)
- m3.CFrame = CFrame.new(-11.4223385, 0.161293387, 16.346323, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
- m3.Anchored = false
- m3.CanCollide = false
- m3.BrickColor = BrickColor.new("White")
- surfaceChange(m3)
- local m4 = Instance.new("Part", mag)
- m4.Name = "Part"
- m4.Size = Vector3.new(0.200000003, 0.200000003, 0.323524684)
- m4.CFrame = CFrame.new(-11.9297647, 0.157671332, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- m4.Anchored = false
- m4.CanCollide = false
- m4.BrickColor = BrickColor.new("White")
- surfaceChange(m4)
- local m5 = Instance.new("Part", mag)
- m5.Name = "PP"
- m5.Size = Vector3.new(0.541903794, 1.01101518, 0.200000003)
- m5.CFrame = CFrame.new(-11.5822363, 0.680492878, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- m5.Anchored = false
- m5.CanCollide = false
- m5.BrickColor = BrickColor.new("White")
- surfaceChange(m5)
- local p2 = Instance.new("Part", model)
- p2.Name = "Handle"
- p2.Size = Vector3.new(0.541903794, 1.01101518, 0.200000003)
- p2.CFrame = CFrame.new(-11.5822363, 0.680492878, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p2.Anchored = false
- p2.CanCollide = false
- p2.BrickColor = BrickColor.new("Medium stone grey")
- surfaceChange(p2)
- local p3 = Instance.new("Part", model)
- p3.Name = "Part"
- p3.Size = Vector3.new(0.541903794, 1.01910317, 0.200000003)
- p3.CFrame = CFrame.new(-11.5817852, 0.684512913, 16.4555092, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p3.Anchored = false
- p3.CanCollide = false
- p3.BrickColor = BrickColor.new("Smoky grey")
- surfaceChange(p3)
- local p4 = Instance.new("Part", model)
- p4.Name = "Part"
- p4.Size = Vector3.new(0.541903794, 1.01910317, 0.200000003)
- p4.CFrame = CFrame.new(-11.5817852, 0.684512913, 16.2371349, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p4.Anchored = false
- p4.CanCollide = false
- p4.BrickColor = BrickColor.new("Smoky grey")
- surfaceChange(p4)
- local p5 = Instance.new("Part", model)
- p5.Name = "Part"
- p5.Size = Vector3.new(0.200000003, 1.05954385, 0.274995983)
- p5.CFrame = CFrame.new(-11.8694487, 0.696427584, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p5.Anchored = false
- p5.CanCollide = false
- p5.BrickColor = BrickColor.new("Smoky grey")
- surfaceChange(p5)
- local p6 = Instance.new("Part", model)
- p6.Name = "Part"
- p6.Size = Vector3.new(0.200000003, 1.05954385, 0.274995983)
- p6.CFrame = CFrame.new(-11.2986317, 0.63239634, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p6.Anchored = false
- p6.CanCollide = false
- p6.BrickColor = BrickColor.new("Smoky grey")
- surfaceChange(p6)
- local p7 = Instance.new("Part", model)
- p7.Name = "Part"
- p7.Size = Vector3.new(0.3073484, 0.307348609, 0.200000003)
- p7.CFrame = CFrame.new(-11.5363941, 0.980687678, 16.4999962, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
- p7.Anchored = false
- p7.CanCollide = false
- p7.BrickColor = BrickColor.new("Black")
- surfaceChange(p7)
- local p8 = Instance.new("Part", model)
- p8.Name = "Part"
- p8.Size = Vector3.new(0.3073484, 0.630873501, 0.200000003)
- p8.CFrame = CFrame.new(-11.6234102, 0.567052245, 16.4999962, 0.993767619, 0.111472785, 0, -0.111472793, 0.99376756, 0, 0, 0, 1)
- p8.Anchored = false
- p8.CanCollide = false
- p8.BrickColor = BrickColor.new("Black")
- surfaceChange(p8)
- local p9 = Instance.new("Part", model)
- p9.Name = "Part"
- p9.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- p9.CFrame = CFrame.new(-11.3422289, 0.824556589, 16.4999962, -0.9937675, 0, 0.111472867, 0.111472875, 0, 0.9937675, 0, 1, 0)
- p9.Anchored = false
- p9.CanCollide = false
- p9.BrickColor = BrickColor.new("Black")
- surfaceChange(p9)
- local p10 = Instance.new("Part", model)
- p10.Name = "Part"
- p10.Size = Vector3.new(0.3073484, 0.630873501, 0.200000003)
- p10.CFrame = CFrame.new(-11.6234102, 0.567052245, 16.1926479, 0.993767619, 0.111472785, 0, -0.111472793, 0.99376756, 0, 0, 0, 1)
- p10.Anchored = false
- p10.CanCollide = false
- p10.BrickColor = BrickColor.new("Black")
- surfaceChange(p10)
- local p11 = Instance.new("Part", model)
- p11.Name = "Part"
- p11.Size = Vector3.new(0.3073484, 0.307348609, 0.200000003)
- p11.CFrame = CFrame.new(-11.5363941, 0.980687678, 16.1926479, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
- p11.Anchored = false
- p11.CanCollide = false
- p11.BrickColor = BrickColor.new("Black")
- surfaceChange(p11)
- local p12 = Instance.new("Part", model)
- p12.Name = "Part"
- p12.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p12.CFrame = CFrame.new(-11.9146175, 0.656711042, 16.3503666, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p12.Anchored = false
- p12.CanCollide = false
- p12.BrickColor = BrickColor.new("Black")
- surfaceChange(p12)
- local p13 = Instance.new("Part", model)
- p13.Name = "Part"
- p13.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p13.CFrame = CFrame.new(-11.8940992, 0.743149281, 16.3503666, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
- p13.Anchored = false
- p13.CanCollide = false
- p13.BrickColor = BrickColor.new("Black")
- surfaceChange(p13)
- local p14 = Instance.new("Part", model)
- p14.Name = "Part"
- p14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- p14.CFrame = CFrame.new(-11.8513021, 1.22758293, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
- p14.Anchored = false
- p14.CanCollide = false
- p14.BrickColor = BrickColor.new("Black")
- surfaceChange(p14)
- local p15 = Instance.new("Part", model)
- p15.Name = "Part"
- p15.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p15.CFrame = CFrame.new(-11.8547096, 0.967769444, 16.3503666, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
- p15.Anchored = false
- p15.CanCollide = false
- p15.BrickColor = BrickColor.new("Black")
- surfaceChange(p15)
- local p16 = Instance.new("Part", model)
- p16.Name = "Part"
- p16.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p16.CFrame = CFrame.new(-11.848114, 0.983309388, 16.3503666, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p16.Anchored = false
- p16.CanCollide = false
- p16.BrickColor = BrickColor.new("Black")
- surfaceChange(p16)
- local p17 = Instance.new("Part", model)
- p17.Name = "Part"
- p17.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p17.CFrame = CFrame.new(-11.8507061, 1.06176257, 16.3503666, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
- p17.Anchored = false
- p17.CanCollide = false
- p17.BrickColor = BrickColor.new("Black")
- surfaceChange(p17)
- local p18 = Instance.new("Part", model)
- p18.Name = "Part"
- p18.Size = Vector3.new(0.376906186, 0.200000003, 0.200000003)
- p18.CFrame = CFrame.new(-11.9414015, 1.36785984, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
- p18.Anchored = false
- p18.CanCollide = false
- p18.BrickColor = BrickColor.new("Black")
- surfaceChange(p18)
- local p19 = Instance.new("Part", model)
- p19.Name = "Part"
- p19.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
- p19.CFrame = CFrame.new(-11.8434582, 1.11297774, 16.3503666, 0.951277733, -0.308335513, 0, 0.308335543, 0.951277614, 0, 0, 0, 1)
- p19.Anchored = false
- p19.CanCollide = false
- p19.BrickColor = BrickColor.new("Black")
- surfaceChange(p19)
- local p20 = Instance.new("Part", model)
- p20.Name = "Part"
- p20.Size = Vector3.new(0.200000003, 0.237790748, 0.200000003)
- p20.CFrame = CFrame.new(-11.9254217, 1.21484756, 16.3503666, 0.756803453, -0.653634727, 0, 0.653631568, 0.756821513, 0, 0, 0, 1)
- p20.Anchored = false
- p20.CanCollide = false
- p20.BrickColor = BrickColor.new("Black")
- surfaceChange(p20)
- local p21 = Instance.new("Part", model)
- p21.Name = "Part"
- p21.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- p21.CFrame = CFrame.new(-12.0393581, 1.33804011, 16.3503666, 0.717730284, -0.696321309, 0, 0.696321249, 0.717730284, 0, 0, 0, 1)
- p21.Anchored = false
- p21.CanCollide = false
- p21.BrickColor = BrickColor.new("Black")
- surfaceChange(p21)
- local p22 = Instance.new("Part", model)
- p22.Name = "Part"
- p22.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- p22.CFrame = CFrame.new(-12.0967665, 1.41755128, 16.3503666, 0.983917534, 0.178622946, 0, -0.178622946, 0.983917534, 0, 0, 0, 1)
- p22.Anchored = false
- p22.CanCollide = false
- p22.BrickColor = BrickColor.new("Black")
- surfaceChange(p22)
- local p23 = Instance.new("Part", model)
- p23.Name = "Part"
- p23.Size = Vector3.new(0.271760672, 0.200000003, 0.200000003)
- p23.CFrame = CFrame.new(-11.9907618, 1.34500718, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
- p23.Anchored = false
- p23.CanCollide = false
- p23.BrickColor = BrickColor.new("Black")
- surfaceChange(p23)
- local p24 = Instance.new("Part", model)
- p24.Name = "Part"
- p24.Size = Vector3.new(0.604991019, 0.200000003, 0.276613623)
- p24.CFrame = CFrame.new(-11.5234394, 1.22756207, 16.3455143, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
- p24.Anchored = false
- p24.CanCollide = false
- p24.BrickColor = BrickColor.new("Black")
- surfaceChange(p24)
- local p25 = Instance.new("Part", model)
- p25.Name = "Part"
- p25.Size = Vector3.new(1.74703312, 0.2685256, 0.323524684)
- p25.CFrame = CFrame.new(-10.9460964, 1.39836848, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p25.Anchored = false
- p25.CanCollide = false
- p25.BrickColor = BrickColor.new("Black")
- surfaceChange(p25)
- local p26 = Instance.new("Part", model)
- p26.Name = "Part"
- p26.Size = Vector3.new(0.511169076, 0.200000003, 0.237790659)
- p26.CFrame = CFrame.new(-11.4444475, 1.2284658, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p26.Anchored = false
- p26.CanCollide = false
- p26.BrickColor = BrickColor.new("Black")
- surfaceChange(p26)
- local p27 = Instance.new("Part", model)
- p27.Name = "Part"
- p27.Size = Vector3.new(0.888075173, 0.200000003, 0.31058377)
- p27.CFrame = CFrame.new(-10.7495079, 1.20498598, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p27.Anchored = false
- p27.CanCollide = false
- p27.BrickColor = BrickColor.new("Black")
- surfaceChange(p27)
- local p28 = Instance.new("Part", model)
- p28.Name = "Part"
- p28.Size = Vector3.new(0.339700907, 0.200000003, 0.200000003)
- p28.CFrame = CFrame.new(-10.1629801, 1.31906176, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p28.Anchored = false
- p28.CanCollide = false
- p28.BrickColor = BrickColor.new("Black")
- surfaceChange(p28)
- local p29 = Instance.new("Part", model)
- p29.Name = "Main"
- p29.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- p29.CFrame = CFrame.new(-9.94953632, 1.48003721, 16.3016109, 0, -1, 1.70171716e-005, 0, 1.70171716e-005, 1, -1, 0, 0)
- p29.Anchored = false
- p29.CanCollide = false
- p29.BrickColor = BrickColor.new("Institutional white")
- surfaceChange(p29)
- local p30 = Instance.new("Part", model)
- p30.Name = "ShootTop"
- p30.Size = Vector3.new(1.80203247, 0.211908743, 0.3510243)
- p30.CFrame = CFrame.new(-10.9396744, 1.61764574, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p30.Anchored = false
- p30.CanCollide = false
- p30.BrickColor = BrickColor.new("Smoky grey")
- surfaceChange(p30)
- local p31 = Instance.new("Part", model)
- p31.Name = "Part"
- p31.Size = Vector3.new(0.200000003, 0.200000003, 0.244261131)
- p31.CFrame = CFrame.new(-10.0182848, 1.47841287, 16.2991848, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
- p31.Anchored = false
- p31.CanCollide = false
- p31.BrickColor = BrickColor.new("Black")
- surfaceChange(p31)
- scan(model)
- weldModel(model, model.Handle)
- weldModel(mag, model.Handle)
- return model
- end
- function activated()
- local gun = createPistol()
- gun.PrimaryPart = gun.Handle
- gun:SetPrimaryPartCFrame(rightArm.CFrame*cf(0, -1, 0)*angles(0, rad(90), 0)*fangles(0, 0, rad(-90)))
- weldBetween(gun.PrimaryPart, rightArm)
- local gun2 = createPistol()
- gun2.PrimaryPart = gun2.Handle
- gun2:SetPrimaryPartCFrame(leftArm.CFrame*cf(0, -1, 0)*angles(0, rad(90), 0)*fangles(0,0,rad(-90)))
- weldBetween(gun2.PrimaryPart, leftArm)
- return gun, gun2
- end
- local g1, g2 = nil, nil
- local ac = false
- local cu = true
- mouse.KeyDown:connect(function(key)
- if key:lower() == "f" then
- if not ac then
- g1, g2 = activated()
- rightArmJoint.Part0 = rightArm
- leftArmJoint.Part0 = leftArm
- rightArmTargetCF = rightArmHoldCF
- leftArmTargetCF = leftArmHoldCF
- ac = true
- else
- currentSide = 1
- rightArmTargetCF = rightArmOriginCF
- leftArmTargetCF = leftArmOriginCF
- wait(0.2)
- g1:Destroy()
- g2:Destroy()
- g1, g2 = nil, nil
- rightArmJoint.Part0 = nil
- leftArmJoint.Part0 = nil
- ac = false
- end
- elseif key:lower() == "q" then
- if ac and cu then
- cu = false
- rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,0)
- leftArmTargetCF = leftArmHoldCF*angles(0,0,rad(30))*cf(0.3,0.5,0)
- for i = 1,20, 1 do
- wait()
- if currentSide == 1 then
- rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,-0.5)
- local hit = mouse.hit.p
- local ray = Ray.new(g1.Main.Position, (mouse.hit.p - g1.Main.Position).unit*500)
- local hit,pos = workspace:FindPartOnRay(ray, char)
- local dist = (mouse.hit.p - g1.Main.Position).magnitude
- local l1 = Instance.new("Part", workspace)
- game.Debris:AddItem(l1, 0.3)
- surfaceChange(l1)
- l1.Size = Vector3.new(0.2,0.2,dist)
- l1.CFrame = CFrame.new(g1.Main.Position, mouse.hit.p)
- l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
- l1.Transparency = 0.5
- l1.BrickColor = BrickColor.new("Really red")
- l1.Anchored = true
- l1.CanCollide = false
- if hit ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent.Humanoid:TakeDamage(30)
- end
- end
- currentSide = 2
- else
- leftArmTargetCF = leftArmHoldCF*angles(rad(0),0,rad(30))*cf(0.3,0.5,-0.5)
- local hit = mouse.hit.p
- local ray = Ray.new(g2.Main.Position, (mouse.hit.p - g2.Main.Position).unit*500)
- local hit,pos = workspace:FindPartOnRay(ray, char)
- local dist = (mouse.hit.p - g2.Main.Position).magnitude
- local l1 = Instance.new("Part", workspace)
- game.Debris:AddItem(l1, 0.3)
- surfaceChange(l1)
- l1.Size = Vector3.new(0.2,0.2,dist)
- l1.CFrame = CFrame.new(g2.Main.Position, mouse.hit.p)
- l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
- l1.Transparency = 0.5
- l1.BrickColor = BrickColor.new("Really red")
- l1.Anchored = true
- l1.CanCollide = false
- if hit ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent.Humanoid:TakeDamage(30)
- end
- end
- currentSide = 1
- end
- wait(0.1)
- rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,0)
- leftArmTargetCF = leftArmHoldCF*angles(0,0,rad(30))*cf(0.3,0.5,0)
- end
- wait(0.2)
- rightArmTargetCF = rightArmHoldCF
- leftArmTargetCF = leftArmHoldCF
- cu = true
- end
- end
- end)
- mouse.Button1Down:connect(function()
- if ac and cu then
- if g1 ~= nil and g2 ~= nil then
- if currentSide == 1 then
- local ray1 = Ray.new(g1.Main.Position, (mouse.hit.p - g1.Main.Position).unit*500)
- local hit,pos = workspace:FindPartOnRay(ray1, char)
- local dist = (mouse.hit.p - g1.Main.Position).magnitude
- rightArmTargetCF = rightArmHoldCF*angles(rad(-30),0,0)
- local l1 = Instance.new("Part", workspace)
- game.Debris:AddItem(l1, 0.3)
- surfaceChange(l1)
- l1.Size = Vector3.new(0.2,0.2,dist)
- l1.CFrame = CFrame.new(g1.Main.Position, mouse.hit.p)
- l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
- l1.Transparency = 0.5
- l1.BrickColor = BrickColor.new("Really red")
- l1.Anchored = true
- l1.CanCollide = false
- if hit ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent.Humanoid:TakeDamage(20)
- end
- end
- currentSide = 2
- wait(0.2)
- rightArmTargetCF = rightArmHoldCF
- else
- local ray1 = Ray.new(g2.Main.Position, (mouse.hit.p - g2.Main.Position).unit*500)
- local hit,pos = workspace:FindPartOnRay(ray1, char)
- local dist = (mouse.hit.p - g2.Main.Position).magnitude
- leftArmTargetCF = leftArmHoldCF*angles(rad(-30),0,0)
- local l1 = Instance.new("Part", workspace)
- game.Debris:AddItem(l1, 0.3)
- surfaceChange(l1)
- l1.Size = Vector3.new(0.2,0.2,dist)
- l1.CFrame = CFrame.new(g2.Main.Position, mouse.hit.p)
- l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
- l1.Transparency = 0.5
- l1.BrickColor = BrickColor.new("Really red")
- l1.Anchored = true
- l1.CanCollide = false
- if hit ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent.Humanoid:TakeDamage(20)
- end
- end
- currentSide = 1
- wait(0.2)
- leftArmTargetCF = leftArmHoldCF
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement