I’m trying to make a system where every 2 seconds it finishes printing, if there is something printing.
The Issue is that the check whether or not printing > 0 doesn’t work, but if change it so that its:
while true do
printing -= 1
printed += 1
printedShown = "Printed: "..tostring(printed)
printingShown = "Printing: "..tostring(printing)
wait(0.5)
end
It works.
I’ve spent 30 minutes trying to fix it, I’ve also tried searching online if anybody had the same problem but couldn’t find anything
Code:
local simulator = script.Parent
local clicker = simulator["Main Clicker"]
local printing = 0
local printed = 0
local printingShown = clicker.PrintingShown.SurfaceGui.TextLabel
local printedShown= clicker.PrintedShown.SurfaceGui.TextLabel
local isTouched = false
local clickAmount = 1
local function addPrint()
if isTouched == false then
isTouched = true
local luckyNumber = math.random(1,500)
if luckyNumber == 250 then
clickAmount += 1
simulator.Lucky.Playing = true
end
printing += clickAmount
printingShown.Text = "Printing: "..tostring(printing)
simulator.ClickSound.Playing = true
wait(0.275)
isTouched = false
end
end
clicker.ClickPart.ClickDetector.MouseClick:Connect(addPrint)
while printing > 0 do
printing -= 1
printed += 1
printedShown = "Printed: "..tostring(printed)
printingShown = "Printing: "..tostring(printing)
wait(0.5)
end
local simulator = script.Parent
local clicker = simulator["Main Clicker"]
local printing = 0
local printed = 0
local printingShown = clicker.PrintingShown.SurfaceGui.TextLabel
local printedShown= clicker.PrintedShown.SurfaceGui.TextLabel
local isTouched = false
local clickAmount = 1
local function addPrint()
if isTouched == false then
isTouched = true
local luckyNumber = math.random(1,500)
if luckyNumber == 250 then
clickAmount += 1
simulator.Lucky.Playing = true
end
printing += clickAmount
printingShown.Text = "Printing: "..tostring(printing)
simulator.ClickSound.Playing = true
wait(0.275)
isTouched = false
end
end
clicker.ClickPart.ClickDetector.MouseClick:Connect(addPrint)
while wait(0.5) do
if printing <= 0 then continue end
printing -= 1
printed += 1
printedShown = "Printed: "..tostring(printed)
printingShown = "Printing: "..tostring(printing)
end
The basic idea is the player can click a brick and start to print something, and every 2 seconds a printing object finishes printing and becomes a printed object
Checking on an empty board, the script works, but it doesn’t get placed on the textlabel, right? that’s because the variable changes to a number when it should be an object
local simulator = script.Parent
local clicker = simulator["Main Clicker"]
local printing = 0
local printed = 0
local printingShown = clicker.PrintingShown.SurfaceGui.TextLabel
local printedShown= clicker.PrintedShown.SurfaceGui.TextLabel
local isTouched = false
local clickAmount = 1
local function addPrint()
if isTouched == false then
isTouched = true
local luckyNumber = math.random(1,500)
if luckyNumber == 250 then
clickAmount += 1
simulator.Lucky.Playing = true
end
printing += clickAmount
printingShown.Text = "Printing: "..tostring(printing)
simulator.ClickSound.Playing = true
wait(0.275)
isTouched = false
end
end
clicker.ClickPart.ClickDetector.MouseClick:Connect(addPrint)
while wait(0.5) do
if printing <= 0 then continue end
printing -= 1
printed += 1
printedShown.Text = "Printed: "..tostring(printed)
printingShown.Text = "Printing: "..tostring(printing)
end