I've tried multiple things, but this is the closest I think I have gotten. Before this is the code for an image button that when pressed, makes some text guis and in 69.72 seconds it teleports to the place I want. I don't know what I'm doing wrong. (The image button and the text gui's all work)
wait(69.72) local TeleportService = game:GetService("TeleportService") local memeplace = 421113879 --Why did I name it memeplace... game.Players.PlayerAdded:connect(function(player) TeleportService:Teleport(memeplace, player) end)
Edit 1: To be more specific, I just want it to teleport to 421113879. When I test it, there is no error message, I tried this new code, the same thing happened. I'll show the whole context of code. It's a local script inside an image button inside a screen gui inside the starter gui folder. The only thing that isn't working is the teleport function. Another fact to add is that there are no errors in the output and script are analysis.
local button = script.Parent local sound = button:WaitForChild('Sound') local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui") local function onButtonClick() sound:Play() local screen = Instance.new("ScreenGui") screen.Parent = PlayerGui local textLabel = Instance.new("TextLabel") textLabel.Parent = screen --The text is here. It's very long, I'll skip that part. (around 10 lines when put into google docs) textLabel.Size = UDim2.new(0.5,0,0.5,0) textLabel.FontSize = Enum.FontSize.Size8 textLabel.TextScaled = true local textLabel = Instance.new("TextLabel") textLabel.Parent = screen --More text :l textLabel.Position = UDim2.new(0,0,0.5,0) textLabel.Size = UDim2.new(0.5,0,0.5,0) textLabel.TextScaled = true local textLabel = Instance.new("TextLabel") textLabel.Parent = screen textLabel.Position = UDim2.new(0.5,0,0,0) textLabel.Size = UDim2.new(0.5,0,0.5,0) textLabel.TextScaled = true --So much text wait(69.72) local function PlayerAdded() local TeleportService = game:GetService("TeleportService") local memeplace = 421113879 game.Players.PlayerAdded:connect(function(player) --Why did I name it memeplace... TeleportService:Teleport(memeplace, player) end) end end button.MouseButton1Click:connect(onButtonClick)
Edit 2: Sorry wfvj014. I didn't understand what you were saying until now. I'll try the new idea you put.
game.Players.PlayerAdded:connect(function(player) --Why did I name it memeplace... TeleportService:Teleport(421113879, player) local TeleportService = game:GetService("TeleportService") end) end
It still doesn't work, there is no error message when this part runs but there is a warning saying "Unknown global 'TeleportService'" When I look at the script. I would like to know a cleaner way to do this.