#PlayerAdded does not trigger when player is teleported

1 messages · Page 1 of 1 (latest)

vague robin
#

Like those horror games where there are multiple lobbies to join (2player, 4 player, 5play etc). But for my case, when a player clicks on a button ui then they will be teleported to a new "world" where they are alone. How would I achieve this? I dont know which service to get started with

cinder etherBOT
#

studio** You are now Level 3! **studio

vague robin
#

thanks

vague robin
blissful drum
#

Shows you the console while in roblox itself

vague robin
#

thanks

vague robin
# blissful drum Shows you the console while in roblox itself

i have a weird problem, the place that the player is being teleported to does not run the server scripts. I only have 1 script in the place:

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

print("listening")
Players.PlayerAdded:Connect(function(player)
    print("welcome player!")
    
    local jd = player:GetJoinData()
    local tpd = jd.TeleportData
    local name = tpd.name

    print(player.Name .. " is joining world: " .. `{name}`)
end)

it does not print anything (image 1) however when i run it in studio it prints perfectly (image 2)

#

the script name is teleported and it is being correctly stored in the serverscriptservice

#

PlayerAdded does not trigger when player is teleported

#

this is how im teleporting my player from the main place

local TeleportService = game:GetService("TeleportService")

local WORLD_SERVER_PLACE_ID = ...-- Your extra place for world hosting

game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnServerEvent:Connect(function (Player, WorldName)
    print(WORLD_SERVER_PLACE_ID)
    --local reservedCode = TeleportService:ReserveServer(WORLD_SERVER_PLACE_ID)
    
    local teleportData = Instance.new("TeleportOptions")
    teleportData:SetTeleportData({ name = WorldName })

    print("teleporting", WorldName, teleportData.TeleportData, teleportData.name)
    wait(5)
    TeleportService:TeleportAsync(WORLD_SERVER_PLACE_ID, {Player}, teleportData)
end)
#

nvm i found the problem, i was publishing the wrong place