There is a property of UIS which is IsKeyDown, it returns the key that is currently hold (It’s a boolean). So probably something like this should work:
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
while UIS:IsKeyDown(Enum.KeyCode.Space) do
Shoot()
wait() -- add a number, however you like
end
end
end)