So i ported my game to a group and payed attention to this SPECIFFICALLY.
I changed the IDs btw.
And yet, when i enter the teleporter, the game crashes with no error. Just the typical white-out windows “program not responding” thing. (yes i waited like 10 minutes before giving up)
cool cool
btw i have to go, something came up so i’ll reply super late
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):Teleport(5558713850,player)
end
end
script.Parent.Touched:connect(onTouched)
The solution is that you need a debounce if the you use this for touch event it will see that you hit it a ton of times therefore you need a debounce i have had this problem in my game aswell
function onTouched(hit)
if debounce == true then
debounce = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService(“TeleportService”):Teleport(5558713850,player)
wait(0.2)
debounce = true
end
end
end
Your code looks fine, although, I would suggest having a table to save players that have hit the teleport block. Something like this:
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local place = 5558713850
local teleporting = {}
local function onTouched(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player and not table.find(teleporting, player) then
table.insert(teleporting, player)
TeleportService:Teleport(place, player)
end
end
script.Parent.Touched:Connect(onTouched)
I don’t know any other issues with your code, and this is all I could get.