Workspace doesn't detect parts

Hello!

I have recently moved something over to another game, and I realised that the scripts that I moved over doesn’t detect the parts in workspace that I moved over. Even if I use :WaitForChild(“”)

Is there any way for workspace to detect the parts / models that I have moved over?

My guess is theres a problem with your code, or the workspace, so could I see an image of the workspace (that includes the parts you are trying to reference) along with the code? My guess is it happened when you moved all this stuff, thats a guess at least!

make sure that the instances that you are trying to reference in the script have the same name for example if an instance name is “AA” and you did workspace:WaitForChild(“aa”) that will not work

also move this topic to scripting support

how far are the models from the spawn point? They may be streamed out. Try disabling StreamingEnabled.

3 Likes

Save, turn off streaming, check again.

image

local player = game.Players.LocalPlayer
local button = script.Parent
local gui = script.Parent.Parent
local currentcamera = game.Workspace.CurrentCamera
local inventorycamerapart = game.Workspace:WaitForChild("InventoryCameraPart")

button.MouseButton1Click:Connect(function()
	currentcamera.CameraType = Enum.CameraType.Scriptable
	if gui.SelectSpaceShipButton.Visible == false then
		currentcamera.CFrame = inventorycamerapart.CFrame + Vector3.new(3, 0, 0)
			
		gui.SelectSpaceShipButton.Visible = true
		gui.SpaceShipListFrame.Visible = true
		
	elseif gui.SelectSpaceShipButton.Visible == true then
		currentcamera.CameraType = Enum.CameraType.Custom
		
		gui.SelectSpaceShipButton.Visible = false
		gui.SpaceShipListFrame.Visible = false
	end
	
	
end)

Thank you so much, this fixed it!

It works when I have StreamingEnabled off
But a question, what do I do if I want to have StreamingEnabled on?

1 Like

use a remote event or some other method to do this serverside, as the server does not get affected by streaming.

You can modify the streaming distance by changing workspace.StreamingMinRadius and workspace.StreamingTargetRadius. If you want, you can change workspace.StreamOutBehaviour to Enum.StreamOutBehaviour.LowMemory to only stream out when memory is low.