Hi, does anyone know why this returns with Workspace.AutomaticDoor.Configuration.Controller:87: attempt to index nil with ‘Connect’
Any help is appreciated!
local locked = Tablets:GetDescendants("Locked")
locked.MouseButton1Down:Connect(function()
if mode ~= 1 then
mode = 1
elseif mode == 1 then
mode = 0
end
end)
I think you mean to use FindFirstDescendant not :GetDescendants as it returns a table of descendants.
local locked = Tablets:FindFirstDescendant("Locked")
locked.MouseButton1Down:Connect(function()
if mode ~= 1 then
mode = 1
elseif mode == 1 then
mode = 0
end
end)
local locked = Tablets:FindFirstChild("Locked", true)
locked.MouseButton1Down:Connect(function()
if mode ~= 1 then
mode = 1
elseif mode == 1 then
mode = 0
end
end)
for i,locked in pairs(Tablets:GetDescendants()) do
if locked.Name == "Locked" then
locked.MouseButton1Down:Connect(function()
if mode ~= 1 then
mode = 1
elseif mode == 1 then
mode = 0
end
end)
end
end
This works, however, my game is crashing from script timeout ive added a wait and it still crashes its only a tween how strange, anyways ty for the help!
You should probably add TweenName.Completed:Wait() wherever you are playing tweens. Change “TweenName” to the name of the variable of which the created tween is assigned to.