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)
.
.
Although the script cannot pick it up
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.