To expand on how you could use task.wait(), you can use the :Once connection to interrupt the otherwise infinite loop. Similar to disconnecting via .Unequipped:Connect
local RunService = game:GetService("RunService")
local Minigun : Tool = script.Parent
local Transfer = script.Parent:WaitForChild("TransferData")
Minigun.Equipped:Connect(function()
local firing = true
Minigun.Unequipped:Once(function()
firing = false
end)
while firing and task.wait(1) do
local Mouse = game.Players.LocalPlayer:GetMouse().Hit.Position
Transfer:FireServer(Mouse)
end
end)