Script not acknowledging child of an object?

I am making a script which reads a value within a folder to change the player’s skybox, although when I run the script, it fails to note the Value within the folder (“WorldName”)

This is the script I am using:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
		local Player = players:GetPlayerFromCharacter(hit.Parent)
		
		local Activeworld = World:FindFirstChildWhichIsA("Folder") -- World 2 (in following example)
		
		Lighting:ClearAllChildren() -- Removes previous skyboxes
		
		local toclone
		
		if Activeworld then
			local WorldName = World:FindFirstChild("WorldName")
			
			if WorldName then
				toclone = WorldName.Value
			end
		end
		
		print (toclone) -- prints as nil
		
		Teleport:FireClient(Player, toclone)
	end
end)
The script has no difficulty in finding "Active World" (as shown here)

.

And "WorldName" is indeed a child of ActiveWorld.2

.

Although the script cannot pick it up

image

What can I do to make it so that the script actually reads ActiveWorld[World].WorldName? I had previously changed the scripts from saying “Name” to “WorldName”, thinking that that would resolve the issue, although it still persists.

1 Like

cuts off the thing we need to see for WorldName
Would be cool if you were to send screenshot instead of phone shots and send a code snippet

1 Like