So I was trying to make a game with ChatGPT but the script wouldn’t work, I just decided to see if you guys could help me improve this script, it’s a script for a gun.
print(“Script’s runnin”)
local MkA = game:GetService(“Workspace”).MkA
local handle = MkA.Handle
local function shoot()
local bullet = Instance.new(“Part”)
bullet.Shape = Enum.PartType.Part
bullet.Size = Vector3.new(0.2, 0.2, 1)
bullet.Color = Color3.new(0.451392, 0.993103, 1)
bullet.CFrame = handle.CFrame * CFrame.new(0, 0, -1.5)
bullet.Velocity = handle.CFrame.lookVector * 100
bullet.Parent = workspace
-- destroy the bullet after a certain amount of time
game:GetService("Debris"):AddItem(bullet, 2)
end
game:GetService(“UserInputService”).InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.F and not gameProcessed then
print(“did it work?”)
shoot()
end
end)