You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to parent a script to a folder under a ScreenGui under PlayerGui.
- What is the issue? Include screenshots / videos if possible!
When the script is parented to the folder, Roblox treats the script as if it’s there but looking in the inspector shows otherwise. This happens with both server and local scripts, so I know that isn’t the issue.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried directly parenting the script instead of making a clone, same issue. This doesn’t happen when I manually create a script in studio then press play. I cannot find anything else on the Developer Hub even remotely relating to this issue, I’ve looked for half an hour at this point.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I don’t know if this is just a bug or whatever, but it’s genuinely annoying me. This makes absolutely no sense whatsoever, and even destroying the folder the script is in doesn’t fire any :Destroyed() events on the script. Using :GetChildren() on the folder shows the script is there, but my issue is it doesn’t show up in studio and I cannot see what is happening there for debugging. This is for a quest system where I parent a quest script into the gui, and the script will hook up to any events to manage quest progress.
Code:
serverStorage.Quests.Test.Parent = plr:WaitForChild("PlayerGui"):WaitForChild("MainUI"):WaitForChild("QuestScripts")
wait(1)
print(plr:WaitForChild("PlayerGui"):WaitForChild("MainUI"):WaitForChild("QuestScripts"):GetChildren())
This is in a PlayerAdded function, so it is fired right when a player joins. “plr” refers to the player who joined. serverStorage is game.ServerStorage, “Quests” is a folder in serverStorage, “Test” is a script.
The wait(1) before printing is just there to make sure the script isn’t being destroyed after a print() function is called to print the children of the folder.
Edit: If there is anywhere else I can parent these scripts to where BOTH server and local scripts will run, and will not be reset when the character dies, that would be a good help too. I’m doing it this way so the rest of the people on my team can easily make scripts themselves, since they can script but don’t understand anything too advanced so I need to make adding things like items, weapons, quests, etc. easy for them.