Trying to learn to script guns, so I decided I would try and make one using part of the wikis script and some of my coding.
local tool = script.Parent local user user = tool.Parent tool.Equiped:connect(function(mouse) missile = Instance.new("Part") missile.Name = "Bullet" missile.Shape = "Block" missile.Anchored = false missile.CanCollide = true missile.CFrame = handle.CFrame missile.Size = Vector3.new(1, 1.2, 7) missile.BrickColor = BrickColor.new("Really black") --when the left mouse button is clicked mouse.Button1Down:connect(function() --make and do a hit test along the ray local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) --do damage to any humanoids hit local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(10) end end) end)
Why are you even asking this question? You have to test it your self then if it does not work, then post this here!