When I press the buttons, the value will get bigger and won't decrease, if the value is larger, then the door won't open? Help? Door script
-- Varibles
local light = script.Parent.Light
local openlight = light.Open
local closelight = light.Close
local door = script.Parent.Door
local buttonpressed = script.Parent.TotalPressed
function teamwork()
if buttonpressed.Value <= 2 then
closelight.Enabled = false
light.BrickColor = BrickColor.new("Lime green")
openlight.Enabled = true
door.Transparency = 0
door.Cancollide = false
end
wait(3)
door.Transparency = 1
door.Cancollide = true
closelight.Enabled = true
light.BrickColor = BrickColor.new("Really red")
openlight.Enabled = false
end
Button script
local pressed = script.Parent.Parent.TotalPressed
function onPressed(hit)
if hit.Parent:findFirstChild("Humanoid") and hit.Parent.Humanoid.Health ~= 0 then
pressed.Value = pressed.Value + 1
script.Parent.BrickColor = BrickColor.new("Really red")
else
pressed.Value = pressed.Value - 1
script.Parent.BrickColor = BrickColor.new("Lime green")
if pressed.Value < 0 then
pressed.Value = 0
end
end
end
script.Parent.Touched:connect(onPressed)
No errors in output If you can, explain why it won't work so I'll know why it's wrong?
