Hey guys, i'm new to scripting in Roblox Studio, so I hope you could help me with a problem... So, i have a ModuleScript and i have a variable called "Buttonleft" in it. My idea is to crate a game that, when 4 buttons are pressed (not necessarily at the same time), a door is opened (like Dead by Daylight and the generators)... My problem is, when i press a button, the variable Buttonleft (wich is a int variable equal to 0) increases the value, becoming Buttonleft = 1. So, i need to everytime a player presses a button, this variable increases, but it is not working. The ModuleScript keep saying that Buttonleft = 1 when i press more than 1 button, when it should be printing "Buttonleft = 2" "Buttonleft = 3" and on and on... But it just doesn't work :/ Here's my codes:
ModuleScript
local Buttons = { Buttonleft = 0 }
return Buttons
Buttons Script
clickquantity = 5
Buttons = require(game.ServerScriptService.Buttons)
function clickbutton()
workspace.Painel2.SurfaceGui.TextLabel.Text = clickquantity .. " Click's left"
clickquantity = clickquantity - 1
if clickquantity == 0 then
workspace.Painel2.SurfaceGui.TextLabel.Text = "Finished Button"
Buttleft = Buttons.Buttonleft
Buttleft = Buttleft + 1
print(Buttleft)
elseif clickquantity < 0 then
workspace.Painel2.SurfaceGui.TextLabel.Text = "Finished Button"
end
end
game.Workspace.Button2.ClickDetector.MouseClick:Connect(clickbutton)
Can you please help me? Thanks :)

1 comment
You could use values.