I don't understand what is wrong. The prints work but the script doesn't.

local teleportService = game:GetService'TeleportService'
local player = script.Parent.Parent.Parent.Parent.Parent

function onClicked()
    print("clicked")
	script.Parent.Click:Play()
    local validPlayer, targetUserId = pcall(game.Players.GetUserIdFromNameAsync, game.Players, script.Parent.Parent.Target.TextBox.Text)

    if validPlayer then
        local isOnline, success, errorMsg, placeId, instanceId = pcall(teleportService.GetPlayerPlaceInstanceAsync, teleportService,targetUserId)
        if isOnline and success then
            teleportService:TeleportToPlaceInstance(placeId, instanceId, player)
		end
end
print("joined")
end

script.Parent.MouseButton1Click:connect(onClicked)

Developer Console just prints what i wanted and shows no errors.

5 comments

0

try it outside of studio

0

Why are these methods still allowed?

0

MCAndROBLOXUnited I did

0

ahhhhhhh ok I see: success, errorMsg, placeId, and instanceId are nil

0

The script looks very deprecated.