RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create me a script for shooting whit max amo of 15 and say to me where to put it"
Sure, here's a basic script for a shooting mechanism with a maximum ammo of 15. This script should be placed in a LocalScript under StarterPlayerScripts. ```lua local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local ammo = 15 tool.Activated:Connect(function() if ammo > 0 then local part = Instance.new("Part") part.Size = Vector3.new(1, 1, 1) part.Position = tool.Handle.Position part.Velocity = (mouse.Hit.p - tool.Handle.Position).unit * 100 part.Parent = workspace ammo = ammo - 1 else print("Out of ammo!") end end) ``` This script creates a new part (the bullet) every time the tool is activated (clicked), as long as there is ammo left. The bullet is given a velocity towards the position of the mouse cursor. Each shot decreases the ammo by 1. If there is no ammo left, a message will be printed to the output. Please note that this is a very basic script and doesn't include features like reloading, bullet physics, or damage calculation. You would need to add those features yourself depending on your game's requirements.