Hi, i just started to learn programming in rbs. Im following a tutorial of a guy named BrawDev and tried making a door. For some reason it's not working so i decided to ask for help, perhaps i can get an answer on why its not functioning
The code is rather simple:
´´
local mainGame = game.Workspace:WaitForChild("MainGame")
local gates = mainGame:WaitForChild("Gates")
local buttons = mainGame:WaitForChild("Buttons")
local function openGate(button, touched)
touched.value = true
local gate = gates:FindFirstChild(button.name)
if gate then
gate.Transparency = 0.5
gate.CanCollide = false
end
local duration = buttons:FindFirstChild("Duration")
task.wait(duration.Value)
gate.Transparency = 0
gate.CanCollide = true
touched.value = false
end
for _, button in pairs(buttons:GetChildren()) do
button.Touched:Connect(function(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
local touched = button:FindFirstChild("Touched")
if humanoid and touched and touched.Value == false then
openGate(button, touched)
end
end)
end
´´
Despite that, while in the video everything went right for some reason mine didnt
** You are now Level 1! **