RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a gun script that shoots out parts"
-- local script local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local shooting = false local function shoot() if shooting then return end shooting = true local part = Instance.new("Part") part.Size = Vector3.new(1, 1, 1) part.BrickColor = BrickColor.new("Bright red") part.Position = tool.Handle.Position part.Parent = workspace part.CanCollide = false local bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) bodyVelocity.Velocity = (mouse.Hit.p - tool.Handle.Position).Unit * 100 bodyVelocity.Parent = part game.Debris:AddItem(part, 5) wait(0.1) shooting = false end tool.Activated:Connect(shoot)