Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how can i get all the data from my game and send it to my placeholder game?

i basically want to get all the data from my main game(httprequests, the name, the ammount of players, the jobid, the placeid) and send them over to my placeholder game using the teleportservice but i dont know how as this is my first time using the teleportservice. i was going to make it a discord webhook but that was very complex for my but i still wanna try and see if it works.

here is the script for teleporting to the placeholder game:

local teleport = game:GetService("TeleportService")
local Players1 = #game:GetService("Players"):GetPlayers()

local https = pcall(function()
	game:GetService('HttpService'):GetAsync('http://www.google.com/') -- Checks to see if http is enabled
end)

local data = {
    name = game.Name,
    id = game.PlaceId,
    jobid = game.JobId,
    http = https,
    plrs = #game.Players:GetPlayers(),
}

game.Players.PlayerAdded:Connect(function(plr)
	print(data.http) -- Starts printing data so i can see if its all working
	wait(.3)
	print(data.name)
	wait(.3)
	print(data.id)
	wait(.3)
	print(data.jobid)
	wait(.3)
	print(data.plrs) 
	print('teleporting')
	wait(8)
	teleport:Teleport(*Placeholder*, plr, data) -- Placeholder is a placeholder.
end)

here is the local script:

local tp = game:GetService("TeleportService")
local player = game.Players.LocalPlayer
local data = tp:GetLocalPlayerTeleportData()
local remote = game.ReplicatedStorage.remoteFunc -- My remotefunction

remote:InvokeServer(data.id, data.name, data.http, data.jobid, data.plrs) -- Trying to send the teleport data to a server script
print(data.id, data.name, data.http, data.jobid, data.plrs) -- Prints so i can see the
wait(8)
tp:Teleport(data.id, player) -- Teleports them back

Server script (In the SSS):

local tp = game:GetService("TeleportService")
local player = game.Players.LocalPlayer
local data = tp:GetLocalPlayerTeleportData()
local remote = game.ReplicatedStorage.remoteFunc

remote:InvokeServer(data.id, data.name, data.http, data.jobid, data.plrs)
print(data.id, data.name, data.http, data.jobid, data.plrs)
wait(8)
tp:Teleport(data.id, player)

i cant seem to get it to work can someone help?

1 answer

The problem is that in the script in SSS, its a server script, so you can't access localplayer in a server script, and idk why you are trying to invokeserver in two scripts, in the server script in SSS you can probably onInvoke it which has the parameter of the player so do in the third script:

local tp = game:GetService("TeleportService")
local remote = game.ReplicatedStorage.remoteFunc

remote.OnServerInvoke:Connect(function(player,dataid, dataname, datahttp, datajobid, dataplrs)
	print(dataid,dataname,datahttp,datajobid,dataplrs)
	tp:Teleport(dataid,player)
end)

1 comment

0

didnt work im getting an error

This discussion is preserved as it was. New answers, comments, and votes are closed.