I’m not entirely sure, I’m not a scripter just trying to fix an old friends script for my usage, these are the only two other scripts in game besides the one I’ve shown, apologies for not being able to narrow it down.
local hubHandle = workspace:WaitForChild(‘HUB’)
game:GetService(‘StarterGui’):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
local guis = {
kingsLanding = script.Parent:WaitForChild(‘KingsLanding’),
credits = script.Parent:WaitForChild(‘Credits’),
updates = script.Parent:WaitForChild(‘Updates’),
}
local originalPos = {}
for i,v in pairs(guis)do
originalPos[i] = v.Adornee.Position
end
function moveUp(part)
local goal = {}
goal.Position = part.Raised.Value
local tweenInfo = TweenInfo.new(0.3)
local tween = game:GetService(‘TweenService’):Create(part, tweenInfo, goal)
tween:Play()
end
function moveDown(part)
local goal = {}
goal.Position = part.Original.Value
local tweenInfo = TweenInfo.new(0.3)
local tween = game:GetService(‘TweenService’):Create(part, tweenInfo, goal)
tween:Play()
end
guis.kingsLanding.Frame.MouseEnter:Connect(function()
moveUp(guis.kingsLanding.Adornee)
end)
guis.kingsLanding.Frame.MouseLeave:Connect(function()
moveDown(guis.kingsLanding.Adornee)
end)
for i,v in pairs(guis)do
v.Frame.MouseEnter:Connect(function()
moveUp(v.Adornee)
script.Hover:Play()
end)
v.Frame.MouseLeave:Connect(function()
moveDown(v.Adornee)
end)
end
–[[guis.kingsLanding.Frame.Play.MouseButton1Click:Connect(function()
–script.Play:Play()
–game.ReplicatedStorage.RemoteEvent:FireServer(1)
–end)
–]]
function disableOthers(exception)
for i,v in pairs(guis.kingsLanding.Frame:GetChildren())do
if v:IsA(‘ImageButton’) and v.Name ~= exception then
v.Visible = false
end
end
end
guis.kingsLanding.Frame.Server1.MouseButton1Click:Connect(function()
disableOthers(‘Server1’)
script.Play:Play()
game.ReplicatedStorage.RemoteEvent:FireServer(1)
end)
guis.kingsLanding.Frame.Server2.MouseButton1Click:Connect(function()
disableOthers(‘Server2’)
script.Play:Play()
game.ReplicatedStorage.RemoteEvent:FireServer(2)
end)
guis.kingsLanding.Frame.Server3.MouseButton1Click:Connect(function()
disableOthers(‘Server3’)
script.Play:Play()
game.ReplicatedStorage.RemoteEvent:FireServer(3)
end)
for i,v in pairs(guis.credits.Frame.ImageLabel.ScrollingFrame:GetChildren())do
if v:IsA(‘Frame’) then
v.Icon.Image = ‘https://www.roblox.com/headshot-thumbnail/image?userId=’… v.Name … ‘&width=420&height=420&format=png’
end
end
while wait() do
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = hubHandle.Camera.CFrame
end
local datastoreService = game:GetService(‘DataStoreService’)
local teleportService = game:GetService(‘TeleportService’)
local dataStore = datastoreService:GetGlobalDataStore(‘Servers’)
local DSS = game:GetService(“DataStoreService”)
local DS = DSS:GetGlobalDataStore()
local ms = game:GetService(“MessagingService”)
local placeId = game.ReplicatedStorage:WaitForChild(‘id’).Value
local servers = require(game.ReplicatedStorage:WaitForChild(‘Servers’))
local serverTable = nil
– Never just use getasync by itself.
local succ = false;
local att = 0
repeat
local s,e = pcall(function()
serverTable = dataStore:GetAsync(‘serverTable’)
end)
succ = s
if not s then
warn('serverTable encountered a getasync issue: ’ … e)
end
att += 1
wait(1)
until succ or att >= 3
if not serverTable then
warn(‘serverTable is empty. ignoring’)
else
servers.server1 = serverTable.server1 or nil – the ‘or nil’ is just for safety
servers.server2 = serverTable.server2 or nil
servers.server3 = serverTable.server3 or nil
servers.code1 = serverTable.code1 or nil – the ‘or nil’ is just for safety
servers.code2 = serverTable.code2 or nil
servers.code3 = serverTable.code3 or nil
end
if servers.server1 == nil then
print(1)
local accessCode, privateServerId = teleportService:ReserveServer(placeId)
servers.server1 = accessCode
servers.code1 = privateServerId
end
if servers.server2 == nil then
print(2)
local accesscode, privateServerId2 = teleportService:ReserveServer(placeId)
servers.server2 = accesscode
servers.code2 = privateServerId2
print(accesscode)
print(privateServerId2)
end
if servers.server3 == nil then
print(3)
local accesscode, privateServerId3 = teleportService:ReserveServer(placeId)
servers.server3 = accesscode
servers.code3 = privateServerId3
print(accesscode)
print(privateServerId3)
end
– whatever
dataStore:SetAsync(‘serverTable’, servers)
game.ReplicatedStorage:WaitForChild(‘RemoteEvent’).OnServerEvent:Connect(function(player, server)
if server == 1 then
teleportService:TeleportToPrivateServer(placeId, servers.server1, {player})
end
if server == 2 then
teleportService:TeleportToPrivateServer(placeId, servers.server2, {player})
end
if server == 3 then
teleportService:TeleportToPrivateServer(placeId, servers.server3, {player})
end
end)
game:GetService(“MessagingService”):SubscribeAsync(“Servers”, function(message)
local serverSwitchingSystem = require(game.ReplicatedStorage:WaitForChild(“ServerSwitchingSystem”))
local type, maxplayers, players, job, place = serverSwitchingSystem:Decode(message.Data)
if type == "+" then
end
end)
while true do
wait(0.5)
print(servers.code1)
print(servers.server1)
DS:SetAsync(servers.code1, servers.server1)
DS:SetAsync(servers.code2, servers.server2)
DS:SetAsync(servers.code3, servers.server3)
end