Good morning, afternoon, or night developers! I am creating a game where you can spawn in an obby from our list of obbies in game, and then you can practice it. Todo this I made a system where you find the name of the obby, you want, and then you type it into the TextBox. After this you press [Spawn] and it should clone from the replicated storage, and put it into the workspace, but I realized when I was testing that apparently TextBox.Text:Clone() does not work. But if the text in the TextBox is a currect name of an obby, then it should work. For example, the obby’s name is TheVolcano, so someone would put it in as the Text and then it would be more like local Obby = ObbiesFolder.TheVolcano:Clone() Why doesn’t it?
local ObbiesFolder = game.ReplicatedStorage:FindFirstChild("Obbies")
local TextBox = script.Parent.Parent.TextBox
ObbyAlreadySpawned = false
script.Parent.MouseButton1Down:connect(function ()
local Obby = ObbiesFolder.TextBox.Text:Clone() --This part is the part that isnt working.
if ObbyAlreadySpawned == false then
Obby.Parent = game.Workspace
ObbyAlreadySpawned = true
end
if ObbyAlreadySpawned == true then
Obby:Remove()
wait(1)
Obby.Parent = game.Workspace
end
end)
if ObbyAlreadySpawned == false then
Obby.Parent = game.Workspace
ObbyAlreadySpawned = true
end
if ObbyAlreadySpawned == true then
Obby:Remove()
wait(1)
Obby.Parent = game.Workspace
end
This is the issue, it creates the obby, then destroys it.
You can’t access textbox text from a server script.
To access the object in the folder by name, you would use ObbiesFolder[TextBox.Text]
The easiest solution to this problem is to put the gui in StarterGui, set the adornee to the part, change the script to a LocalScript, then make the change I mentioned in number 2.