TextButton grabbing something in a folder of ServerStorage

I am trying to make an “admin panel” to spawn certain objects. When I had tried to specify the ServerStorage, I just got a 'attempt to index nil with" error. I tried pasting the folder into ReplicatedStorage, but the objects did not work properly. The script of the ScrollingFrame is below.
Could someone help address the main issue and possibly fix it? Thanks.

local storage = game:GetService("ReplicatedStorage")
local entities = storage:FindFirstChild("DebugEntities")
local replicatedStorage = game.ReplicatedStorage
	
script.Parent.serverse.MouseButton1Click:Connect(function()
	local newModel = entities.DEFAULT:Clone()
	newModel.Parent = workspace
	newModel:PivotTo(game.ReplicatedStorage.Assets.LatestRoom.Value.Entrance.CFrame)
	
end)

script.Parent.ann.MouseButton1Click:Connect(function()
	local newModel = entities["CHECK-IT"]:Clone()
	newModel.Parent = workspace
	newModel:PivotTo(game.ReplicatedStorage.Assets.LatestRoom.Value.Entrance.CFrame)
end)

script.Parent.tenna.MouseButton1Click:Connect(function()
	local newModel = entities["A-200"]:Clone()
	newModel.Parent = workspace
	newModel:PivotTo(game.ReplicatedStorage.Assets.LatestRoom.Value.Entrance.CFrame)
end)

script.Parent.sisy.MouseButton1Click:Connect(function()
	local newModel = entities["X-200"]:Clone()
	newModel.Parent = workspace
	newModel:PivotTo(game.ReplicatedStorage.Assets.LatestRoom.Value.Entrance.CFrame)
end)

script.Parent.eagle.MouseButton1Click:Connect(function()
	local newModel = entities["A-20"]:Clone()
	newModel.Parent = workspace
	newModel:PivotTo(workspace.StartingRoom.Exit.CFrame)

	local hitbox = replicatedStorage.Assets.Hitbox:Clone()
	hitbox:PivotTo(newModel.PrimaryPart.CFrame)
	hitbox.WeldConstraint.Part1 = newModel.HumanoidRootPart
	hitbox.Parent = workspace
end)
-- The rest of the script is similar to the contents shown above

You’re getting that error because entities is nil. The script is trying to do entities.DEFAULT but entities doesn’t exist.

That happens because you’re calling :FindFirstChild("DebugEntities") on something that probably doesn’t contain that folder at all from the perspective of the client. Based on what you wrote, your folder is in ServerStorage, and ServerStorage is only accessible from server scripts. LocalScripts can’t access it, which is why the reference fails.

If you moved it to ReplicatedStorage and it “didn’t work”, it’s probably because the logic tied to those entities was expecting to run on the server or be spawned by a server script. The proper approach is to have the LocalScript send a RemoteEvent to the server when the player clicks the button. Then have a Script on the server handle the actual spawning by cloning the object from ServerStorage and parenting it to the Workspace.

Trying to spawn server-only assets directly from the client won’t work. You want to keep your spawning logic on the server where it belongs.

So,

  1. Move the DebugEntities folder back into ServerStorage.
  2. Create a RemoteEvent in ReplicatedStorage, call it something like RequestEntitySpawn.
  3. In your LocalScript (the one connected to the TextButton), replace the direct call with:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local spawnEvent = ReplicatedStorage:WaitForChild("RequestEntitySpawn")

button.MouseButton1Click:Connect(function()
    spawnEvent:FireServer("DEFAULT") -- or whatever entity name you want to spawn
end)
  1. In a Script (not LocalScript) in ServerScriptService, handle the request:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local spawnEvent = ReplicatedStorage:WaitForChild("RequestEntitySpawn")

spawnEvent.OnServerEvent:Connect(function(player, entityName)
    local entity = ServerStorage:FindFirstChild("DebugEntities"):FindFirstChild(entityName)
    if entity then
        local clone = entity:Clone()
        clone.Parent = workspace
    end
end)

This way the button still triggers the spawn, but correctly through the server.