Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Game not working with 2 players?

Asked by 9 years ago

Ive made this game and it works perfectly with 1 player, but doesnt work with 2. it teleports 1 player into the map, after the 60 seconds is over it never comes back.

while true do

local ranNum = math.random(1,1)
wait(1)
local hint = Instance.new('Hint', Workspace)
hint.Text = "Intermission"
wait(10)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "3"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "2"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "1"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "Go!"
wait(1)
hint:Destroy()
if ranNum == 1 then
    game.ServerStorage.Map1:Clone().Parent = game.Workspace
    for i, v in pairs(game.Players:GetPlayers()) do
        v.Character.Torso.CFrame = CFrame.new(Vector3.new(-8, 34.9, 47))
        wait(60)
        game.Workspace.Map1:Destroy()
    end
end
game.Workspace.Map1:Destroy()


end

This works perfectly with 1 person, im not sure why it goes wrong. Its inside a normal script.

1 answer

Log in to vote
0
Answered by 9 years ago

You tried to wait(60) and :Destroy() the map for every player that is in the game. Try moving the wait(60) and :Destroy() to rite after the for loop.

while true do

local ranNum = math.random(1,1)
wait(1)
local hint = Instance.new('Hint', Workspace)
hint.Text = "Intermission"
wait(10)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "3"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "2"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "1"
wait(1)
hint:Destroy()
local hint = Instance.new('Hint', Workspace)
hint.Text = "Go!"
wait(1)
hint:Destroy()
if ranNum == 1 then
    game.ServerStorage.Map1:Clone().Parent = game.Workspace
    for i, v in pairs(game.Players:GetPlayers()) do
        v.Character.Torso.CFrame = CFrame.new(Vector3.new(-8, 34.9, 47))
    end
    wait(60)
    game.Workspace.Map1:Destroy()
end
game.Workspace.Map1:Destroy()


end
0
on line 33? LittleBigDeveloper 245 — 9y
0
It worked :), i dont know how but it did LittleBigDeveloper 245 — 9y
Ad

Answer this question