Group game's place teleporter doesn't work

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)

Any help is appreciared. :smiley:

You haven’t provided much for us to work with. I would suggest you show your code so we can further debug your issue.

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)

Is there anyway that i can see the script i can’t really help with this.

If the game is crashing check if you have set a while true do loop

make sure to add occasional wait() just to fix any processing errors

when using while true do put a wait so it looks like this

while true do
wait() — this prevents crashing
end

1 Like

script in an earlier reply
(30something)

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

this should be the initial working script :smiley:

local debounce = true

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

script.Parent.Touched:connect(onTouched)

1 Like

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.

@zQ86 @Frepzter
I will check the scripts later, since i have work to do here.

But my script worked until now. (Do group places have different rules?)

Thank you for helping.