Hey fellow developers, I have been using a toolbox door system (since Im too lazy to do one myself), It has been working perfectly until today. Today it randomly started to refusing working. It’s only making half of the door work (there is about 60 doors). I have been trying to fix it myself by removing all the doors, re pasting them re-naming folders in the workspace and in the script, nothing works the only thing I’m getting output of is bellow:
StarterPlayer.StarterPlayerScripts.door_client - Studio
00:11:26.938 Infinite yield possible on 'ReplicatedStorage:WaitForChild("door")' - Studio
00:11:26.939 Script 'StarterPlayer.StarterPlayerScripts.door_client', Line 20
00:11:26.960 Infinite yield possible on 'ReplicatedStorage:WaitForChild("door")' - Studio
00:11:26.960 Script 'StarterPlayer.StarterPlayerScripts.door_client', Line 20
and
00:22:50.496 Infinite yield possible on 'Workspace.DoorWorking.SlideDoor:WaitForChild("door1")' - Studio
00:22:50.496 Script 'StarterPlayer.StarterPlayerScripts.door_client', Line 156 - Studio - door_client:156
00:22:50.497 Infinite yield possible on 'Workspace.DoorWorking.SlideDoor:WaitForChild("door1")' - Studio
00:22:50.497 Script 'StarterPlayer.StarterPlayerScripts.door_client', Line 156 - Studio - door_client:156
This has been happening even though nothing has been touched since.
Also here is the code bellow:
-- << - << Services >> - >> --
local players = game:GetService('Players')
local replicated = game:GetService('ReplicatedStorage')
local uis = game:GetService('UserInputService')
local rs = game:GetService('RunService')
local ts = game:GetService("TweenService")
-- << - << Variables >> - >> --
local plr = players.LocalPlayer
local plr_gui = plr:WaitForChild('PlayerGui')
local doors = {}
local char
local hum
local torso
local closest_door = nil
local min_distance = 6
local door_func = replicated:WaitForChild('door')
local ui = script:WaitForChild('doorUI')
local frame = ui:WaitForChild('frame')
local interact_text = frame:WaitForChild('interact')
local warning_text = interact_text:WaitForChild('warning')
local tween_infos = {
lights = TweenInfo.new(.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0),
BlastDoor = TweenInfo.new(3.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0),
SlideDoor = TweenInfo.new(1.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0),
text = TweenInfo.new(.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
}
local last_message_tween = tick()
local last_click = tick()
local messages = {
["denied"] = "You are unable to perform this action.",
["granted"] = "You successfully completed this action.",
["debounce"] = "This door is currently being used.",
["lockdown"] = "This door is on lockdown status."
}
-- << - << Functions >> - >> --
local function verify_door(obj)
if obj:IsA('Model') and obj:FindFirstChild('clearances') and obj.PrimaryPart then
return true
end
end
local function can_see(part)
local vector = (part.Position - torso.Position)
local infov = vector:Dot(torso.CFrame.lookVector) > 0
if infov and vector.magnitude < 9e8 then
local ray = Ray.new(torso.Position, vector.unit * 999)
local part, hitPosition = workspace:FindPartOnRay(ray, char)
return part, infov
end
return false
end
local function get_closest_door() --credit to software for the idea of using table.sort (big brain)
local distances = {}
for door, info in pairs(doors) do
distances[#distances+1] = {door, plr:DistanceFromCharacter(info.center.Position)}
end
table.sort(distances, function(obj1, obj2)
return obj1[2] < obj2[2]
end)
if distances[1] and distances[1][2] <= min_distance then
return distances[1][1]
end
end
local function fade_message(text,arg,arg2)
if text:IsA('TextLabel') then
local tween
if arg == 'Out' then
tween = ts:Create(text,tween_infos.text,{
TextTransparency = 1,
TextStrokeTransparency = 1
}):Play()
elseif arg == 'In' then
tween = ts:Create(text,tween_infos.text,{
TextTransparency = 0,
TextStrokeTransparency = 0.85
}):Play()
end
if arg2 then tween.Completed:Wait() end
end
end
-- << - << Code >> - >> --
uis.InputBegan:Connect(function(input, process)
if input.KeyCode == Enum.KeyCode.E and not process and closest_door and char and hum.Health > 0 and tick()-last_click >= .5 then
last_click = tick()
local msg = door_func:InvokeServer(closest_door)
if msg then
warning_text.Text = messages[msg]
fade_message(warning_text, 'In')
last_message_tween = tick()
delay(3, function()
if tick()-last_message_tween >= 3 then
fade_message(warning_text, 'Out')
end
end)
end
end
end)
plr.CharacterAdded:Connect(function(newchar)
char = newchar
hum = char:WaitForChild('Humanoid')
torso = hum.RigType == Enum.HumanoidRigType.R15 and char:WaitForChild('UpperTorso') or char:WaitForChild('Torso')
ui.Parent = plr_gui
hum_died = hum.Died:Connect(function()
rs:UnbindFromRenderStep('door')
ui.Parent = script
closest_door = nil
hum_died:Disconnect()
end)
rs:BindToRenderStep('door', 300, function()
local door = get_closest_door()
if door and can_see(door.PrimaryPart) then
closest_door = door
fade_message(interact_text, 'In')
repeat wait(); until get_closest_door() ~= door or hum.Health <= 0 or not char or not can_see(door.PrimaryPart)
fade_message(interact_text, 'Out')
end
end)
end)
plr.CharacterRemoving:Connect(function()
rs:UnbindFromRenderStep('door')
ui.Parent = script
closest_door = nil
if hum_died then hum_died:Disconnect() end
end)
for _, door in pairs(workspace:WaitForChild('DoorWorking'):GetChildren()) do
if verify_door(door) and not doors[door] then
if door.Name == 'BlastDoor' or door.Name == 'SlideDoor' or door.Name == "SlideDoors2" then --add different door types here, only add them if you know what you're doing ;)
local door1, door2 = door:WaitForChild('door1'), door:WaitForChild('door2')
local last_open = tick()
doors[door] = {
center = door.PrimaryPart,
open = door:WaitForChild('open'),
lights = door:WaitForChild('lights'):GetChildren(),
door1 = door1,
door2 = door2,
open_cf1 = door1.CFrame * CFrame.new(0, 0, door1.Size.Z),
closed_cf1 = door1.CFrame,
open_cf2 = door2.CFrame * CFrame.new(0, 0, door2.Size.Z),
closed_cf2 = door2.CFrame
}
local info = doors[door]
door1.CFrame = info.open.Value and info.open_cf1 or info.closed_cf1
door2.CFrame = info.open.Value and info.open_cf2 or info.closed_cf2
info.open:GetPropertyChangedSignal('Value'):Connect(function()
last_open = tick()
local tween1 = ts:Create(door1, tween_infos[door.Name], {CFrame = info.open.Value and info.open_cf1 or info.closed_cf1})
local tween2 = ts:Create(door2, tween_infos[door.Name], {CFrame = info.open.Value and info.open_cf2 or info.closed_cf2})
tween1:Play()
tween2:Play()
for _, light in pairs(doors[door].lights) do
ts:Create(light, tween_infos.lights, {Color = doors[door].open.Value and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255,0,0)}):Play()
end
delay(2,function()
if tick() - last_open >= 2 then
for _, light in pairs(doors[door].lights) do
ts:Create(light, tween_infos.lights, {Color = Color3.fromRGB(255,255,255)}):Play()
end
end
end)
end)
end
end
end
And:
---------------------------------CREDITS-------------------------------
--DEVELOPER: Soliform USERID: 53981661
---------------------------------CREDITS-------------------------------
-- << - << Services >> - >> --
local replicated = game:GetService('ReplicatedStorage')
-- << - << Variables >> - >> --
local doors = {}
local doors_folder = workspace.DoorWorking
local door_func = replicated.door
local min_distance = 6
local debounce_lengths = {
BlastDoor = 2,
SlideDoor = .5
}
-- << - << Functions >> - >> --
local function verify_door(obj)
if obj:IsA('Model') and obj:FindFirstChild('clearances') and obj.PrimaryPart then
return true
end
end
local function check_clearance(plr,door)
if plr.Character and doors[door] then
for i,v in pairs(plr.Backpack:GetChildren()) do
if v:IsA('Tool') and doors[door].clearances[v.Name] then
return true
end
end
for i,v in pairs(plr.Character:GetChildren()) do
if v:IsA('Tool') and doors[door].clearances[v.Name] then
return true
end
end
end
end
door_func.OnServerInvoke = function(plr, door)
if doors[door] and plr.Character then
local info = doors[door]
local distance = plr:DistanceFromCharacter(info.center.Position)
if distance ~= 0 and distance <= min_distance then
if check_clearance(plr, door) then
if tick() - info.last_open >= debounce_lengths[door.Name] then
info.open_val.Value = not info.open_val.Value
info.last_open = tick()
for i, v in pairs(info) do
if typeof(v) == 'Instance' and v:IsA('Sound') then
v:Stop()
end
end
if info.open_val.Value and info.open then
info.open:Play()
elseif not info.open_val.Value and info.close then
info.close:Play()
end
if info.granted then info.granted:Play() end
return 'granted'
else
if info.denied then info.denied:Play() end
return 'debounce'
end
else
if info.denied then info.denied:Play() end
return 'denied'
end
end
end
end
-- << - << Code >> - >> --
for _, door in pairs(doors_folder:GetChildren()) do
if verify_door(door) and not doors[door] then
doors[door] = {
open_val = door.open,
clearances = require(door.clearances),
center = door.center or door.PrimaryPart,
open = door.center:FindFirstChild('open'),
close = door.center:FindFirstChild('close'),
granted = door.center:FindFirstChild('granted'),
denied = door.center:FindFirstChild('denied'),
last_open = tick()
}
end
end
---------------------------------CREDITS-------------------------------
--DEVELOPER: Soliform USERID: 53981661
---------------------------------CREDITS-------------------------------
Any help would be really apreciated as of now developpment of my game is halted