#player tracker
1 messages · Page 1 of 1 (latest)
Always post script. Copy the script and paste it between these
```lua
--paste in here
```
ik how to lol
ty tho
even went to chat gpt and that didnt do shit 
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MessagingService = game:GetService("MessagingService")
-- RemoteFunction to allow mods to request job ID by code
local JobCodeEvent = Instance.new("RemoteFunction")
JobCodeEvent.Name = "GetJobServerByCode"
JobCodeEvent.Parent = ReplicatedStorage
-- Function to generate a random 5-digit code
local function generateJobCode()
local code = ""
for _ = 1, 5 do
code = code .. tostring(math.random(0, 9))
end
return code
end
-- Generate the job code for this server
local jobCode = generateJobCode()
local jobId = game.JobId -- Only works in live servers
local placeId = game.PlaceId
warn("[Server Job Code] Generated Code: " .. jobCode)
-- Publish job to global registry (optional)
MessagingService:PublishAsync("JobCodeRegistry", {
Code = jobCode,
JobId = jobId,
PlaceId = placeId
})
-- Handle requests for a job ID by code
JobCodeEvent.OnServerInvoke = function(player, enteredCode)
if enteredCode == jobCode then
return {
JobId = jobId,
PlaceId = placeId
}
else
return nil
end
end
heres the server
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TeleportToPlayerServer = ReplicatedStorage:WaitForChild("TeleportToPlayerServer")
local player = Players.LocalPlayer
local usernameBox = script.Parent:WaitForChild("jobidbox") -- used for target username
local joinButton = script.Parent:WaitForChild("joinjobid")
joinButton.MouseButton1Click:Connect(function()
local targetUsername = usernameBox.Text
local success, data = pcall(function()
return TeleportToPlayerServer:InvokeServer(targetUsername)
end)
if success and data then
TeleportService:Teleport(data.GameId, player, {
TeleportData = {
TargetPlaceId = data.PlaceId,
TargetJobId = data.JobId
}
})
else
warn("Failed to find or teleport to player.")
end
end)
this is the local:
and then theres the one more server script for the main game
local TeleportService = game:GetService("TeleportService")
Players.PlayerAdded:Connect(function(player)
local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData
if teleportData and teleportData.TargetPlaceId and teleportData.TargetJobId then
print("Redirecting player to target server:", teleportData.TargetJobId)
TeleportService:TeleportToPlaceInstance(
teleportData.TargetPlaceId,
teleportData.TargetJobId,
player
)
end
end)
Just making sure. Did you test teleporting in Roblox Studio? @cinder lagoon
Cause teleporting doesnt work when testing in Roblox Studio
no in game, like 20 times
i like to really make sure lol
Good. Then I will check scripts. Could you add the lua formatting to them? helps me see
just append lua like this: ```lua
in the script stuff
Yes please and thank you
yeah ofc
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TeleportToPlayerServer = ReplicatedStorage:WaitForChild("TeleportToPlayerServer")
local player = Players.LocalPlayer
local usernameBox = script.Parent:WaitForChild("jobidbox") -- used for target username
local joinButton = script.Parent:WaitForChild("joinjobid")
joinButton.MouseButton1Click:Connect(function()
local targetUsername = usernameBox.Text
local success, data = pcall(function()
return TeleportToPlayerServer:InvokeServer(targetUsername)
end)
if success and data then
TeleportService:Teleport(data.GameId, player, {
TeleportData = {
TargetPlaceId = data.PlaceId,
TargetJobId = data.JobId
}
})
else
warn("Failed to find or teleport to player.")
end
end)
local:
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TeleportToPlayerServer = ReplicatedStorage:WaitForChild("TeleportToPlayerServer")
local player = Players.LocalPlayer
local usernameBox = script.Parent:WaitForChild("jobidbox") -- used for target username
local joinButton = script.Parent:WaitForChild("joinjobid")
joinButton.MouseButton1Click:Connect(function()
local targetUsername = usernameBox.Text
local success, data = pcall(function()
return TeleportToPlayerServer:InvokeServer(targetUsername)
end)
if success and data then
TeleportService:Teleport(data.GameId, player, {
TeleportData = {
TargetPlaceId = data.PlaceId,
TargetJobId = data.JobId
}
})
else
warn("Failed to find or teleport to player.")
end
end)```
server:
local TeleportService = game:GetService("TeleportService")
Players.PlayerAdded:Connect(function(player)
local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData
if teleportData and teleportData.TargetPlaceId and teleportData.TargetJobId then
print("Redirecting player to target server:", teleportData.TargetJobId)
TeleportService:TeleportToPlaceInstance(
teleportData.TargetPlaceId,
teleportData.TargetJobId,
player
)
end
end)
server
You did a mistake
Like this
```lua
```
You can edit your message instead of sending new ones
oof
```lua
--Your code inbetween
```
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TeleportToPlayerServer = ReplicatedStorage:WaitForChild("TeleportToPlayerServer")
local player = Players.LocalPlayer
local usernameBox = script.Parent:WaitForChild("jobidbox") -- used for target username
local joinButton = script.Parent:WaitForChild("joinjobid")
joinButton.MouseButton1Click:Connect(function()
local targetUsername = usernameBox.Text
local success, data = pcall(function()
return TeleportToPlayerServer:InvokeServer(targetUsername)
end)
if success and data then
TeleportService:Teleport(data.GameId, player, {
TeleportData = {
TargetPlaceId = data.PlaceId,
TargetJobId = data.JobId
}
})
else
warn("Failed to find or teleport to player.")
end
end)
local:
ty
!!!
-- ServerScriptService/JobCodeManager.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MessagingService = game:GetService("MessagingService")
-- RemoteFunction to allow mods to request job ID by code
local JobCodeEvent = Instance.new("RemoteFunction")
JobCodeEvent.Name = "GetJobServerByCode"
JobCodeEvent.Parent = ReplicatedStorage
-- Function to generate a random 5-digit code
local function generateJobCode()
local code = ""
for _ = 1, 5 do
code = code .. tostring(math.random(0, 9))
end
return code
end
-- Generate the job code for this server
local jobCode = generateJobCode()
local jobId = game.JobId -- Only works in live servers
local placeId = game.PlaceId
warn("[Server Job Code] Generated Code: " .. jobCode)
-- Publish job to global registry (optional)
MessagingService:PublishAsync("JobCodeRegistry", {
Code = jobCode,
JobId = jobId,
PlaceId = placeId
})
-- Handle requests for a job ID by code
JobCodeEvent.OnServerInvoke = function(player, enteredCode)
if enteredCode == jobCode then
return {
JobId = jobId,
PlaceId = placeId
}
else
return nil
end
end
server:
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
Players.PlayerAdded:Connect(function(player)
local joinData = player:GetJoinData()
local teleportData = joinData.TeleportData
if teleportData and teleportData.TargetPlaceId and teleportData.TargetJobId then
print("Redirecting player to target server:", teleportData.TargetJobId)
TeleportService:TeleportToPlaceInstance(
teleportData.TargetPlaceId,
teleportData.TargetJobId,
player
)
end
end)
server:
Does it warn you of no players found
I cant see TeleportToPlayerServer.OnInvoke happening anywhere. So i dont know why it doesnt return data or a false success
if i was in the same game it would work
weird
yeah but jobid is for one game and what i need is across games
a game on roblox called project delta has a player tracker just like this
so i know its some what possible
I mean, you didnt send it. Its not in the scripts you sent
so do i have it setup correctly or?
Dont think so. You are using TeleportToPlayerServer:InvokeServer
but TeleportToPlayerServer.OnInvoke doesnt exist in the scripts you sent me, meaning afaik it isnt use. I cant debug if i dont know how you handle TeleportToPlayerServer.OnInvoke
Hey we can always do this another time
my 12:00 is your <t:1747735200:t> atleast if that helps for planning when later
damn ye ty
** You are now Level 4! **
You could use memory service to store the player's current server via job id, and when you search for him it should try to fetch the memory store and if it exists then teleport to the server via job id
i said up there that after a while a went to chat gpt.
jobid's is for game only, you cant use it between games like im trying to do.
Then you could save both place id and job id in the same memory store
im not smart enough lmao
something ill prolly do in the future
PlaceId_JobId just save this in the memory store of the player and fetch it when needed