SpawnGui won't work with StreamingEnabled

My spawn GUI doesn’t seem to work with streaming enabled on, even after adding WaitForChild().
Does anyone know what I’m doing wrong?

Error

image
image
I’ve even added WaitForChild and it still won’t work
image

Try adding :FindFirstChild(), instead of WaitForChild()

1 Like

I did and it still didn’t work

Can i see your gui? ( The spawn gui thing )

1 Like
wait(1)

-- Made by Lev_Vassal and CheetahSp33d

local Player = game.Players.LocalPlayer
local Character = Player.Character
local CurrentCamera = game.workspace.CurrentCamera
local Humanoid = Character:WaitForChild("Humanoid")
local Music = script.Parent.Music
local CamBrick = workspace:FindFirstChild("camPos")
local startergui = game:GetService("StarterGui")

print ("Step1")



print ("Step2")



for i,v in pairs(script.Parent:WaitForChild("SpawnFrame"):GetDescendants()) do
  if v:IsA("TextButton") then
    v.MouseEnter:connect(function()
    script.Parent.Slide:Play()
    end)
  end
end

for i,v in pairs(script.Parent:WaitForChild("SpawnFrame"):GetDescendants()) do
  if v:IsA("TextButton") then
    v.MouseButton1Down:connect(function()
    script.Parent.Click:Play()
    end)
  end
end

if not Player:FindFirstChild("PlayerData") then
  Instance.new("Configuration", Player).Name = "PlayerData"
  Instance.new("BoolValue", Player.PlayerData).Name = "Introduction"
end

print ("Step4")

if Player.PlayerData.Introduction.Value == false then
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
  for i,v in pairs(script.Parent.Effects:GetChildren()) do
    v.Enabled = true
		v:Clone().Parent = game.workspace.CurrentCamera
	end
	script.Parent.CombatBlur:Clone().Parent = game.workspace.CurrentCamera
  CurrentCamera.CameraType=Enum.CameraType.Scriptable
  CurrentCamera.CoordinateFrame=CamBrick.CFrame+CamBrick.CFrame.lookVector
  Music:Play()

end

if Player.PlayerData.Introduction.Value == true then
	game.workspace.CurrentCamera.Blur.Size = 0
	game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true) 
	CurrentCamera.CameraType=Enum.CameraType.Scriptable
	CurrentCamera.CoordinateFrame=CamBrick.CFrame+CamBrick.CFrame.lookVector
	script.Parent:WaitForChild("SpawnFrame").Visible = true
end






print ("Step5")




function closeverything()
Player.PlayerData.Introduction.Value = true
--local gui = game.ReplicatedStorage.GUI:WaitForChild("Tutorial"):Clone()

  script.Parent.Music:Stop()
  for i=1, 100 do
  game.workspace.CurrentCamera.Blur.Size = game.workspace.CurrentCamera.Blur.Size - 1.20
  wait(0.00001)
    CurrentCamera.CameraType = Enum.CameraType.Custom
    CurrentCamera.CameraSubject = Humanoid
    game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
	script.Parent.SpawnFrame.Visible = false
	--gui.Parent = Player.PlayerGui

  end
end
print ("Step6")


script.Parent.SpawnFrame:WaitForChild("Open1").MouseButton1Click:connect(function()
game.ReplicatedStorage.RemoteEvents:WaitForChild("SpawnTeleport"):FireServer(game.Workspace.SpawnLocations.Open1)


closeverything()
startergui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
startergui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
end
end)

Can you show me your configuration folder?

image

1 Like

After your :WaitForChild("SpawnLocations"), chain another one onto that for Open1:

game.ReplicatedStorage.RemoteEvents:WaitForChild("SpawnTeleport"):FireServer(workspace:WaitForChild("SpawnLocations"):WaitForChild("Open1"))

4 Likes

Here it is
image

I tried that and it still didn’t work. I didn’t get anything in the output either.

1 Like

Keep the name same, but change Configuration to Folder

2 Likes

Tried it and it still doesn’t seem to work.

image

1 Like

try adding wait(2) before that code…

Because scripts are working early before player joins…

2 Likes

Clients usually will not have the entire Workspace available locally. Developers must ensure that game functionality works when clients are missing parts of the world, such as by using Instance:WaitForChild (Please be aware that there is a chance WaitForChild will hang forever if the instance being waited for is never streamed in and that a timeout in WaitForChild is not specified).

Quoted from the streaming enabled topic:

Specify a timeout for your WaitForChild, for your part.
game.ReplicatedStorage.RemoteEvents:WaitForChild("SpawnTeleport"):FireServer(workspace:WaitForChild("SpawnLocations"):WaitForChild("Open1", 1))

1 Like

This worked, I could finally get past the spawn GUI however I wasn’t able to teleport to my brick’s position like it should. Does StreamingEnabled also affect Server Scripts?

I’m not sure entirely. I don’t think it should be an issue as long as the brick is streamed in at some point. Can you perhaps provide your code so we can help?

1 Like
game.ReplicatedStorage.RemoteEvents:WaitForChild("SpawnTeleport").OnServerEvent:Connect(function(Player, Location)
Player.Character.UpperTorso.CFrame = CFrame.new(Location.Position + Vector3.new(0,3,0))
end)

This is the code in the Server, do you see anything wrong with it?

1 Like

No, I honestly don’t see anything wrong with it. I just did a quick repro, I got teleported. Seems fine :thinking: