What do you want to achieve? I’m trying to make a teleport script, which plays a function on event server fire.
What is the issue? I’m getting this error:
What solutions have you tried so far? I searched Developer forum, but couldn’t find anything.
This is the code:
local teleport = game.ReplicatedStorage:WaitForChild("TeleportPlayer")
local teleportService = game:GetService("TeleportService")
local placeId = 11814731717
local Players = game:GetService("Players")
local playerToTeleport = Players:GetPlayers()[1]
teleport.OnServerEvent:Connect(function()
teleportService:TeleportAsync(placeId, {playerToTeleport})
end)
EDIT: I changed the script a bit, by following Roblox Documentation Guide, but it still gives the same error.
Hey so I fixed this by making a local script, and just saying teleportService:Teleport(placeId), which works and fills my requirements/the way I wanted it to work.
That’s not the exact same thing… The script that xGOA7x edited, was first supposed to be a server script. However, the script which I replied with couple minutes ago, is a local script without the player variable and a function, just the :Teleport() event. Plus I don’t think that it really matters, if you say they are exact same…
The function he gave you is the exact same thing. He put it in the remote event because that’s what he figured you wanted since you tried to do it earlier. He gave you the function, whatever/however you use it doesn’t matter