Hello, I'm creating a mini game where the player escapes from the lava. The minigame starts when a player presses a button, so to make all the players teleport and the lava starts to move I created a script, note:
lava = game.Workspace.lava2
local teleporte = script.Parent
function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(-55.831, 11.008, 183.894))
teleporte.ClickDetector.MaxActivationDistance = 0
local player = game.Players:GetPlayers()
for i, p in pairs(player) do
if game.Workspace:FindFirstChild(p.Name) then
p.Character.HumanoidRootPart.Orientation = Vector3.new(0, -1.01, 0)
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
local lava = game.Workspace.lava2
local numero = 0
function clicar()
while true do
wait(0.8)
lava.Size = lava.Size+Vector3.new(0,0,4)
numero = numero + 1
print(numero)
if numero == 221 then
lava.Size = Vector3.new(18, 40.2, 1)
wait(0.00001)
break
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(clicar)
I think that in the script there is no problem, what I'm worried about is whether the script I made to teleport players and rotate them will teleport and rotate everyone and not just a player. Can someone help me with this?
I also think we could improve the script that makes the lava move, because the lava moves in two directions, when it should be just one

1 comment
If you're unsure if it works with multiple people then go into the test tab and start a server with atleast 2 players