The main issue
As showcased above, whenever I press the ‘New Game’ button, the error pops up. I have turned on and off Third part teleports, I’ve tried TeleportAsync, Teleport and ReserveServer+TeleportToPrivateServer and have had no successful result.
Code
Server-side data script
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local TeleportService = game:GetService("TeleportService")
local PlayerQuerys = DataStoreService:GetDataStore("PlayerQuerys")
local Utils = game.ReplicatedStorage:WaitForChild("Utils")
local Client = Utils:WaitForChild("Client")
local QueryRequests = game.ReplicatedStorage:WaitForChild("QueryRequests")
local CharacterUtils = require(Client:WaitForChild("CharacterUtils"))
Players.PlayerAdded:Connect(function(Player)
local CharacterDataQuery = CharacterUtils:CharacterDataQueryTemplate()
local RetrievedQuery
local Success, FailureReason = pcall(function()
RetrievedQuery = PlayerQuerys:GetAsync(Player.UserId.. "--query")
end)
if (FailureReason) then
warn("Failure in loading data\n<".. FailureReason.. ">")
Player:Kick("There was a failure in data load, please rejoin and try again.")
end
print("CharacterDataQuerys Loaded")
if (RetrievedQuery) then
-- Load in Data
print("CharacterDataQueryEvaluation: no new player lol")
else
-- Create new Data
print("CharacterDataQueryEvaluation: new player")
QueryRequests:WaitForChild("NewDataInit"):FireClient(Player, game:GetService("TeleportService"):ReserveServer(11415291695))
end
end)
QueryRequests:WaitForChild("NewDataInit").OnServerEvent:Connect(function(Player, PrivateServerCode)
TeleportService:TeleportToPrivateServer(11415291695, PrivateServerCode, {Player})
end)
Client-side data script
-- my worst nightmare
local TeleportService = game:GetService("TeleportService")
local QueryRequests = game.ReplicatedStorage:WaitForChild("QueryRequests")
local NewDataQuery = QueryRequests:WaitForChild("NewDataInit")
local LoadGui = script.Parent
NewDataQuery.OnClientEvent:Connect(function(PrivateServerCode)
script.Parent.Parent:WaitForChild("NewGameUI").Enabled = true
script.Parent.Parent:WaitForChild("NewGameUI"):WaitForChild("NewGameBttn").MouseButton1Click:Wait()
game:GetService("TweenService"):Create(LoadGui:WaitForChild("TopFrame"), TweenInfo.new(1), {Size = UDim2.new(1, 0, 0, 185), BorderSizePixel = 100}):Play()
game:GetService("TweenService"):Create(LoadGui:WaitForChild("BottomFrame"), TweenInfo.new(1), {Size = UDim2.new(1, 0, 0, 385), BorderSizePixel = 100}):Play()
TeleportService:SetTeleportGui(LoadGui)
NewDataQuery:FireServer(PrivateServerCode)
end)