local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local plrs = {}
local Place = nil
local dungeon = game.ServerStorage.Dungeons:FindFirstChild(plr.Name)
script.Parent.MouseButton1Click:Connect(function()
for i, player in pairs(dungeon.Players:GetChildren()) do
table.insert(plrs,1,game.Players:FindFirstChild(player.Name))
end
local placeholder = dungeon.Map.Value .."".. dungeon.Diff.Value .."".. tostring(dungeon.HC.Value)
Place = game.ReplicatedStorage.IDs:FindFirstChild(tostring(placeholder)).Value
local RSID = game:GetService("TeleportService"):ReserveServer(Place)
game:GetService("TeleportService"):TeleportToPrivateServer(Place,RSID,plrs)
end)
This is the script that is supposed to tp you and all players into the correct dungeon, but I always get an error at line 7 saying "Attempt to index nil with Players". I know there is a players folder, correct capitalization and everything, so why isnt this working?
Other notes: -This is a serverscript -It's inside a textbutton -I've had this error before, but I can't fix it the same way as then.

1 comment
It's spaghetti code, please fix it and I can try and help better (https://en.wikipedia.org/wiki/Spaghetti_code#:~:text=Spaghetti%20code%20is%20a%20pejorative,and%20insufficient%20ability%20or%20experience.)