I'm making a script that you press and it toggles on or off, when it's on it fires a server over and over again fast, there's no errors in the output so I'm assuming I'm missing something... If you need more context just ask and I can probably give.
local isOff = true
local autoSpawn = false
function leftclick()
if isOff == true then
script.Parent.Parent.BackgroundColor3 = Color3.new(155,155,155)
isOff = false
autoSpawn = true
else
if isOff == false then
script.Parent.Parent.BackgroundColor3 = Color3.new(255,255,255)
autoSpawn = false
end
end
end
while true do
wait()
if autoSpawn == true then
game.ReplicatedStorage.GiveStand:FireServer()
end
end
script.Parent.MouseButton1Click:Connect(leftclick)

1 comment
its glaringly obvious why it wont work: you have an infinite loop preventing it from doing anything.