The problem is that when I touch the button the wall transpercy is not changeing. I think this is probarly the script.
Here is the code:
local mainGame = game.Workspace:WaitForChild("MainGame")
local gates = mainGame:WaitForChild("Gates") -- gets the gates
local buttons = mainGame:WaitForChild("Buttons") -- gets the buttons
local function activateButton(button,touched) -- function to activate the button
touched.Value = true
local gate = gates:FindFirstChild(buttons.Name) -- finds child gate
local duration = button:FindFirstChild("Duration") -- finds child duration
local timer = duration.Value -- error here
while timer > 0 do -- timer program
print(timer)
task.wait(1)
timer = timer - 1
end
if gate then -- when child gate has been found
gate.Transparency = 0.5
gate.CanColide = true
print("hi")
end
--task.wait(duration.Value)
end
for _, button in pairs(buttons:GetChildren()) do -- a loop to get the chlidren of the buttons
button.Touched:Connect(function(otherpart)
local humanoid = otherpart.Parent:FindFirstChild("Humanoid") -- finds child humanoid
local touched = button:FindFirstChild("Touched") -- finds child touched
if humanoid and touched and touched.Value == false then -- activates the button if false
activateButton(button,touched)
end
end)
end