Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this Script not Teleport the player?

Asked by
DogeIXX 172
5 years ago

Hey. I am currently having a problem with the Teleport. (Sadly at release of the game :( )

This Script is located in a LocalScript in a TextButton.

In Studio it says "Cant Teleport in Studio", but in Roblox Player it does nothing.

Script

script.Parent.MouseButton1Click:Connect(function()
        local TeleportService = game:GetService("TeleportService")
        local placeID_1 = 3718647234
local Players = game:GetService("Players")
local player = Players.LocalPlayer  
TeleportService:Teleport(placeID_1, player)
end)

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Just replace the "PlayGST.MouseButton1Click:Connect(function()" with your button


local Player = game.Players.LocalPlayer local ID = "UR ID" local TS = game:GetService("TeleportService") local PlayGST = script.Parent.Parent.PlayCT PlayGST.MouseButton1Click:Connect(function() print("hit") TS:Teleport(ID, Player) end)
Ad
Log in to vote
0
Answered by
poke7667 142
5 years ago

I believe the issue you are having is because you are inputting a player value when it’s not required (assuming that this is a localscript).

Answer this question