here is the script that sets the id
local player = game.Players.LocalPlayer local places = player.places local id = script.Parent.Parent.TextBox.Text function click() places.p11.Value = id script.Parent.Parent.Parent.Parent.Parent.MyGames.page1.game1.ImageLabel.Image = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=230&assetId=" .. id end script.Parent.MouseButton1Click:Connect(click)
script that teleports you
local Players = game:GetService("Players") local TeleportService = game:GetService("TeleportService") local player = game.Players.LocalPlayer local placeId = player.places.p11.Value wait() function click() TeleportService:Teleport(placeId, player) end script.Parent.MouseButton1Click:Connect(click)
Try using tonumber
on the Id:
local Players = game:GetService("Players") local TeleportService = game:GetService("TeleportService") local player = game.Players.LocalPlayer wait() function click() TeleportService:Teleport(tonumber(player.places.p11.Value), player) end script.Parent.MouseButton1Click:Connect(click)
You are running the code local placeId = player.places.p11.Value
before the player updates this value. The variable placeId
will be the same each time.
You need to get the new value
script.Parent.MouseButton1Click:Connect(function() TeleportService:Teleport(player.places.p11.Value, player) end)
Hope this helps.