I've been trying to find some videos that could help me script, but none of them matched the idea I wanted to have. Im wondering if there's a script where a certain amount of players step onto an object, they would all teleport to a game. If there is please show me!
COMMUNITY QUESTION
Is there a script where i can teleport only ten players to a game?
1 answer
If I'm understanding your concept correctly, you want an object to be stepped on by ATLEAST 10 players before a game starts. This can be done by making a variable of how many steps there are and adding to this variable every time the object is touched.
local part = workspace.TouchedPart -- replace "TouchedPart" with the part's name. If it is in any other service, please tell me.
steps = 0
part.Touched:Connect(function(hit)
steps = steps + 1 -- takes the current ammount of steps and adds by 1.
warn("Only "..10 - steps.." players needed before game starts!")
end)
If you wanted this to be more advanced, you could have a base part which when touched by a whitelisted player shortens the steps.
This next part is optional and will just decrease the chances of a player moving from the object once touched.
local part = workspace.TouchedPart -- replace "TouchedPart" with the part's name. If it is in any other service, please tell me.
steps = 0
part.Touched:Connect(function(hit)
ht = hit
steps = steps + 1 -- takes the current ammount of steps and adds by 1.
warn("Only "..10 - steps.." players needed before game starts!")
for i,v in pairs(hit.Parent:GetChildren()) do
if v:IsA("Part") then
v.Anchored = true
v.CFrame = part.CFrame + Vector3.new(0,5,0)
v.CanCollide = false
end
end
end)
if steps >= 10 then
for i,v in pairs(ht.Parent:GetChildren()) do
if v:IsA("Part") then
v.Anchored = false
v.CanCollide = true
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
u want it by part touching or ?