ak47 = Instance.new("Tool") ak47.Parent = game.Players.Player.Backpack ak47.GripPos = Vector3.new(-0,-0.10000000149012,0.69999998807907) ak47.Grip = CFrame.new(-0,-0.10000000149012,0.69999998807907) * CFrame.Angles(-9.9999997171807e-010, -1.0000000133514e-010, 1.0000912714276e-015) ak47.GripForward = Vector3.new(1.0000000133514e-010,-9.9999997171807e-010,-1) ak47.Name = "AK47" ak47.GripRight = Vector3.new(1,1.0001912213153e-015,1.0000000133514e-010) ak47.GripUp = Vector3.new(-1.0000912714276e-015,1,-9.9999997171807e-010) handle = Instance.new("Part",ak47) handle.FormFactor = Enum.FormFactor.Plate handle.TopSurface = Enum.SurfaceType.Smooth handle.Size = Vector3.new(1,2,5) handle.Name = "Handle" handle.CFrame = CFrame.new(-25.213916778564,0.48495537042618,-61.464176177979) * CFrame.Angles(-0.024566793814301, -1.4979313611984, 1.5458176136017) handle.BrickColor = BrickColor.new("Black") handle.Friction = 0.30000001192093 handle.BottomSurface = Enum.SurfaceType.Smooth mesh = Instance.new("SpecialMesh",handle) mesh.Scale = Vector3.new(2,1.5,1.5) mesh.MeshId = "http://www.roblox.com/asset/?id=3824749" mesh.TextureId = "http://www.roblox.com/asset/?id=3824746" mesh.VertexColor = Vector3.new(0.40000000596046,0.40000000596046,0.40000000596046) mesh.MeshType = Enum.MeshType.FileMesh Fire = Instance.new("Sound") Fire.Parent = ak47.Handle Fire.Pitch = 0.75 Fire.Name = "Fire" Fire.Volume = 3 Fire.SoundId = "http://roblox.com/asset/?id=139711658" Tool = ak47; local arms = nil local torso = nil local welds = {} function Equip(mouse) wait(0.01) arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")} torso = Tool.Parent:FindFirstChild("Torso") if arms ~= nil and torso ~= nil then local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false sh[1].Part1 = nil sh[2].Part1 = nil local weld1 = Instance.new("Weld") weld1.Part0 = torso weld1.Parent = torso weld1.Part1 = arms[1] weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90)) welds[1] = weld1 local weld2 = Instance.new("Weld") weld2.Part0 = torso weld2.Parent = torso weld2.Part1 = arms[2] weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) welds[2] = weld2 end else print("sh") end else print("arms") end end function Unequip(mouse) if arms ~= nil and torso ~= nil then local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false sh[1].Part1 = arms[1] sh[2].Part1 = arms[2] welds[1].Parent = nil welds[2].Parent = nil end else print("sh") end else print("arms") end end Tool.Equipped:connect(Equip) Tool.Unequipped:connect(Unequip) local Tool = ak47; enabled = true function onButton1Down(mouse) if not enabled then return end enabled = true mouse.Icon = "rbxasset://textures\\GunCursor.png" --wait(.5) --mouse.Icon = "rbxasset://textures\\GunCursor.png" --enabled = true --mouse.Button1Up:connect(function() onButton1Up(mouse) end) end function onButton1Up(mouse) enabled = false Tool.Enabled = false mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" wait(1) mouse.Icon = "rbxasset://textures\\GunCursor.png" enabled = true Tool.Enabled = true end function onEquippedLocal(mouse) if mouse == nil then print("Mouse not found") return end mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.Button1Up:connect(function() onButton1Up(mouse)end) end Tool.Equipped:connect(onEquippedLocal) Tool = ak47 colors = {2, 0, 0} function fire(v) Tool.Handle.Fire:play() local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local missile = Instance.new("Part") local spawnPos = vCharacter.PrimaryPart.Position spawnPos = spawnPos + (v * 8) missile.Position = spawnPos missile.Size = Vector3.new(1,1,1) missile.Velocity = v * 900 missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)]) missile.Shape = 0 missile.BottomSurface = 0 missile.TopSurface = 0 missile.Name = "Paintball" missile.Elasticity = 0 missile.Reflectance = 0 missile.Friction = .3 local force = Instance.new("BodyForce") force.force = Vector3.new(0,100,0) force.Parent = missile local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Parent = game.Workspace --wait(0.05) --fire( function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") humanoid.Health = humanoid.Health - 15 if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - 15 wait(2) untagHumanoid(humanoid) end end end function check(en) ---------------------------------------Function start here. if (Tool.Enabled == false) then return false end--end for if! ------------------------------- if (Tool.Enabled == true) then return true end ---------------------------------------Function end here. end Tool.Enabled = true function onActivated() if not Tool.Enabled then return end --Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit if (check()) then fire(lookAt) wait(0.55) onActivated() end return --Tool.Enabled = true end ak47.Activated:connect(onActivated) ball = missile damage = 16 function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") humanoid.Health = humanoid.Health - 15 if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - 15 wait(2) untagHumanoid(humanoid) end connection:disconnect() ball.Parent = nil end function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid end end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end