Issues with teleporter/assignment script

Hello, I’m having an issue with a system that I made that assigns players an island and another part of the system that is a GUI that has a list of buttons allowing you to teleport to your island or another players island. The issue I’m having is when I teleport to another players island, it doesn’t actually bring me to their island, to brings me to a random one. When I reset my character then all of a sudden the button to go to the players island isn’t there anymore. If anyone can spot out any problems or errors, I would greatly appreciate it!

Server Script located in Workspace:

--get a list for connections
local ConnectionList = {}

local ColorList = {Color3.new(1, 0, 0),Color3.new(0, 0.666667, 0),Color3.new(0, 0.333333, 1),Color3.new(0.333333, 0, 1)
	,Color3.new(1, 1, 1),Color3.new(0.0784314, 0.0784314, 0.0784314),Color3.new(1, 0.333333, 0),Color3.new(1, 1, 0)
}

--get a list of the islands
local IslandList = workspace.Builds:WaitForChild("Islands"):GetChildren()
--assign a color to each island
for n = 1,#IslandList do
	IslandList[n]:SetAttribute("IslandColor",ColorList[n])
end


local busy = false

function FindIslandByUserId(id)
	for _,i in pairs(IslandList) do
		if i:GetAttribute("UserId") == id then
			return i
		end
	end
end


function onPlayerAdded(player)
	--this sets the player tag IsLoaded to show that we have found our way to this function and do not need to call this again in the loop at the bottom
	player:SetAttribute("IsLoaded",true)


	--Wait until not busy and find empty island
	while busy do task.wait() end
	busy = true
	local island = FindIslandByUserId(nil)
	if not island then 
		busy = false
		error("Not Enough Empty Islands") 
		return	
	end
	--set this islands PlayerId to the players PlayerId
	island:SetAttribute("UserId",player.UserId)
	busy = false


	--handle connections for character added
	if player.Character then --catches any character that might have been created before this script created the event handler
		ConnectionList[player.UserId] = player.CharacterAdded:Connect(onCharacterAdded)
		onCharacterAdded(player.Character)		
	else
		ConnectionList[player.UserId] = player.CharacterAdded:Connect(onCharacterAdded) 
	end
end

function onPlayerRemoved(player)
	
	
	--cleanup connections
	if ConnectionList[player.UserId] then
		ConnectionList[player.UserId]:Disconnect()
		ConnectionList[player.UserId] = nil
	end 
end

game.Players.PlayerAdded:Connect(onPlayerAdded)
game.Players.PlayerRemoving:Connect(onPlayerRemoved)


--catches a player that might have connected before this script could finish setting up event handlers
for _,player in pairs(game.Players:GetPlayers()) do
	if not player:GetAttribute("IsLoaded") then
		onPlayerAdded(player)
	end
end

Local script located in the GUI:

	--get button
local HomeButton = script.Parent:WaitForChild("Button")
local ButtonTemplate = HomeButton:Clone()
local text = script.Parent.Button

function FindIslandByUserId(id)
	for _,i in pairs(workspace.Builds:WaitForChild("Islands"):GetChildren()) do
		if i:GetAttribute("UserId") == id then
			return i
		end
	end
end

local player = game.Players.LocalPlayer
text.Text = player.Name

function onButtonClicked(button)
	local id = button:GetAttribute("UserId")
	local island = FindIslandByUserId(id)
	if island then
		local character = game.Players.LocalPlayer.Character
		local spawnPad = island:WaitForChild("Spawn")
		local hrp = character:WaitForChild("HumanoidRootPart")
		local humanoid = character:WaitForChild("Humanoid")
		while character.Parent ~= workspace do task.wait() end
		character:PivotTo(spawnPad.CFrame+Vector3.new(0,7,0))
		script.Parent.Parent.Enabled = false
	end
end

HomeButton:SetAttribute("UserId",game.Players.LocalPlayer.UserId)
HomeButton.MouseButton1Click:Connect(function() onButtonClicked(HomeButton) end)

--setup event
local ButtonList = {}

function CreateButtons()
	for _,i in pairs(ButtonList) do
		if i[2] then i[2]:Disconnect() end
		if i[1] then i[1]:Destroy() end 
	end
	ButtonList = {}
	for _,i in pairs(workspace.Builds:WaitForChild("Islands"):GetChildren()) do
		local player = game.Players:GetPlayerByUserId( i:GetAttribute("UserId"))
		if player and player ~= game.Players.LocalPlayer then
			local button = ButtonTemplate:Clone()
			button.Text = player.Name
			button.Name = player.Name
			button.Parent = script.Parent:WaitForChild("ScrollingFrame")
			local connection = button.MouseButton1Click:Connect(function() onButtonClicked(button) end)
			table.insert(ButtonList{button,connection})
			print(ButtonList)
		end
	end
end

for _,i in pairs(workspace.Builds.Islands:GetChildren()) do
	i:GetAttributeChangedSignal("UserId"):Connect(function()
		CreateButtons()
	end)
end


Picture of the GUI layout:
image

Basically when a player touches a part it opens up the TeleportGui. Once they click one of the buttons to tp to a players island, it brings them to the island and closes the Gui. When they want to leave, they click a part and a different Gui pops up basically just bringing them down. (I did not include the gui / script for the Gui that brings them down). If you can help me out I would greatly appreciate it!

Is anyone able to spot any errors or make any suggestions on this?