- What do you want to achieve?
i was making a system that when the map was loaded
a cable/key would spawn on the spawnpart.
everything work when the map.parent(Loop)
hasnt been written yet. but after i made the loop system
the key wouldnt spawn on the spawn part.
- What is the issue? Include screenshots / videos if possible!
The error on the dev console says:
Infinite Yield Possible At: Workspace:WaitForChild(“Map”)
or
Map Is Not A Valid Member Of Workspace “Workspace”
- What solutions have you tried so far?
I have try rewritting it but it didnt work.
Heres The 2 Scripts:
gameFunc:
local map = game.Workspace.Map
local Breaker = map.Breaker
local switch1 = Breaker.BreakerSwitch0.Light
local switch2 = Breaker.BreakerSwitch1.Light
local beam0 = Breaker.Beam
local beam1 = Breaker.Beam2
local tool0 = game.ServerStorage.Cable
local tool1 = game.ServerStorage.Cable1
local MainDoor = map.MainDoor
local Door = MainDoor.ScriptedComponents.Door
local DoorButton = MainDoor.ScriptedComponents.Button
local doorDest = MainDoor.ScriptedComponents.DoorDest
local spawns = map.Spawns:GetChildren()
local event = game.ReplicatedStorage.Gui
local OpenSound = Door.Parent.Parent:WaitForChild("sound")
local prox1 = switch1.ProximityPrompt
local prox2 = switch2.ProximityPrompt
local doorProx = DoorButton.ProximityPrompt
prox1.Triggered:Connect(function()
SpawnTool2()
beam0.Enabled = true
task.wait()
prox1:Destroy()
end)
prox2.Triggered:Connect(function()
doorProx.Enabled = true
beam1.Enabled = true
task.wait()
prox2:Destroy()
end)
function ButtonClicked(Player)
OpenSound:Play()
DoorButton.ProximityPrompt:Destroy()
for i = 0,1,0.0001 do
task.wait()
Door.CFrame = Door.CFrame:Lerp(doorDest.CFrame, i)
end
end
function SpawnTool1()
local newItem = tool0:Clone()
local ItemSpawn = spawns[math.random(1,#spawns)]
newItem.Handle.CFrame = ItemSpawn.CFrame
newItem.Parent = workspace
end
function SpawnTool2()
local newItem = tool1:Clone()
local ItemSpawn = spawns[math.random(1,#spawns)]
newItem.Handle.CFrame = ItemSpawn.CFrame
newItem.Parent = workspace
end
event.OnServerEvent:Connect(function()
print("a player has escaped")
end)
SpawnTool1()
DoorButton.ProximityPrompt.Triggered:Connect(ButtonClicked)
gameLoop:
local map = game.ServerStorage:WaitForChild("Map")
while true do
map.Parent = game.Workspace
wait(30)
map.Parent = game.ServerStorage
end
here are the images: