Hi, I have a VIP server system which teleports players to other’s vips. When the player clicks the join button it fires a remote event but It gives an error argument two missing or nil
Server script:
local DS = DataStoreService:GetGlobalDataStore()
local code = DS:GetAsync("ReservedServer")
newserver.OnServerEvent:Connect(function(plr)
local bool = false
for i,v in ipairs(servers) do
if game.PrivateServerId == v.id and v.plr == plr.UserId then
bool = true
break
end
if v.plr == plr.UserId and v.id ~= game.PrivateServerId then
TS:TeleportToPrivateServer(9619375620,v.server,{plr})
bool = true
end
end
if bool == false then
code = TS:ReserveServer(9619375620)
DS:SetAsync("ReservedServer",code)
ServerUpdate(code,plr.UserId)
TS:TeleportToPrivateServer(9619375620,code,{plr})
end
end)
asktoinvite.OnServerEvent:Connect(function(plr)
local success , err = pcall(function()
TS:TeleportToPrivateServer(9619375620 , code , {plr})
end)
if not success then
warn(err)
end
end)
Client script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("AskToInvite")
local button = script.Parent
button.MouseButton1Click:Connect(function()
event:FireServer()
end)
Any help would be appreciated, thanks!