I want to a make script that if you stand on a part you get teleported to a minigame in the map after 20 seconds (I just want to create a ‘queue’ with wait(20) . But I want the script to have a limit of 8 different player touches because I don’t want more than 8 people in that minigame at the same time. I need the script to start a cooldown of 120 seconds after the players that stood on the part got teleported. After that cooldown it can be touched by < 8 players again . The teleport and the cooldown also has to work after 20 seconds ‘queue’ if only 1 player touches the part. So it has to be in a loop. I searched for more than 8 hours on google but couldn’t find anything. If you have any questions, please reply. I hope someone can help me.
Note: I want players to teleport within the same server. So no game id’s or anything. Just the same server as the lobby is in.
note2: I’m at work so i will reply after 19:30 cest
This is what I’ve tried, but couldn’t figure out how to make it work as I described above. (It would just allow people to sometimes teleport and sometimes have a cooldown for unknown time period even when changing the values.)
local tagg=0
local plrs={}
Workspace.patat.Touched:connect(function(hot)
local plr = game.Players:GetPlayerFromCharacter(hot.Parent)
if tick()-tagg 120 then
return end
if plr then
plr.Character.HumanoidRootPart.CFrame = CFrame.new(-54.936, 0.5, 100.038)
end
if plr then
if not plrs[plr] and #plrs <8 then
table.insert(plrs,plr)
if #plrs == 8 then
tagg=tick()
end
end
end
end)
This is the part. It’s in workspace. The other 4 grey scripts are disabled.