Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a limit on the number of local scripts in the StarterGui?

I have 2 local scripts in the StarterGui at the moment that are both initially disabled.One of them places a room, and the other places a single block. When you click on a button, it changes the script to enabled and allows the user to place the room. Here is the code inside the button that activates the placement script:

placement = script.Parent.Parent.Parent.StorageRoomPlacement

script.Parent.MouseButton1Click:connect(function()
	
	placement.Disabled = false
	
end)

However whenever I start the game, it outputs an error that says: "20:55:49.221 - StorageRoomPlacement is not a valid member of PlayerGui", and now the other script says the same thing. Are you only allowed a certain amount of local scripts in the StarterGui or is it something else?

3 comments

2

There is no limit on how many scripts you can have in StarterGui.

2

I don't think ROBLOX sets a cap, but too many will affect game performance. Your error means that the path is incorrect. It may not have loaded yet(use WaitForChild()) or you may have moved it or its just pointing to the wrong location

0

It will lag your game if you make the scripts laggy but there is no limit

1 answer

Try this.

Put this script in the GUI button.

local ServerStorage = game:GetService("ServerStorage") --use this to find the server storage(put the localscript in here)

placement = ServerStorage.localscript

script.Parent.MouseButton1Click:connect(function()
	local location= ServerStorage.placement:Clone() --makes a copy of the script
	location.Parent = game.Workspace -- replace game.Workspace with the location you want the script to goto.
	location.Disabled = false
end)

If it helps, then accept my answer please.

This discussion is preserved as it was. New answers, comments, and votes are closed.