script.Parent.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
game:GetService("TeleportService"):Teleport(4931146666, player)
end)
It says invalid player to teleport
script.Parent.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
game:GetService("TeleportService"):Teleport(4931146666, player)
end)
It says invalid player to teleport
I don't know much about teleport service, but I would try replacing local player = blah blah bah with
local player = game:GetService("Players").LocalPlayer
See if that works.
You cannot teleport through a client sided localscript. I recommend using remote events.
server script, no local!
local TeleportService = game:GetService("TeleportService")
local cd = game.workspace.blabla -- your clickdetector's location
local place2 = 000000000 --your place Id
cd.MouseClick:connect(function(playerclicked)
TeleportService:Teleport(place2, playerclicked)
end
if that did'nt work i suggest...
local TeleportService = game:GetService("TeleportService")
local place2 = 000000000 -- your place ID
local teleTo = game.Workspace. -- the to touch part
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(place2, player)
end
end
teleTo.Touched:Connect(onPartTouch)
try using a to touch part
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Is it LocalScript?
Yes