Hello Developers!
This Topic Is Typical Actually…
I Wanted Make a game with teleport to other place, but the game just ignores that when i step on the brick.
I dont know what is issue, but if you can then please help me.
The Script is:
local TeleportService = game:GetService(“TeleportService”)
local placeID_1 = 123
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(placeID_1, player)
end
end
script.Parent.Touched:Connect(onPartTouch)
By the way I Know that this topic were created a few times alredy, but When I Tried to fix that it wasn’t working right.
here it works for me put this script in a part and make sure its not a local script or a module
local TeleportService = game:GetService("TeleportService")
local gameID = 5874289066
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
TeleportService:Teleport(gameID, player)
end
end
script.Parent.Touched:connect(onTouched)