Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

These scripts only work in studio play mode, not actualy game mode... can anyone help?

Round script placed in workspace :

local oldMessage = ""
local minPlayers = 2

function teleportAllPlayers()
    local target = CFrame.new(workspace.BrickYouTeleportTo.TeleportTarget.Position)
    for i, player in ipairs(game.Players:GetChildren()) do
        player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
        player.Playing.Value = 1

        for _, child in pairs(game.Players:GetChildren())do
            child.Team = game.Teams:WaitForChild("Alive");
        end
        --add an offset of 5 for each character
    end
end

function message(message)
    if oldMessage ~= message then
        oldMessage = message
        print(message)
    end
end

function playersCurrentlyPlaying()
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.Playing.Value == 1 then return true end
    end
    return false
end

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            player.Playing.Value = 0
        end)
    end)

    local playing = Instance.new("IntValue", player)
    playing.Value = 0
    playing.Name = "Playing"
end)


while(true) do
    wait(2)
    for _, localPlayer in pairs(game.Players:GetChildren())do
        if #game.Players:GetPlayers() >= minPlayers then
            if playersCurrentlyPlaying() then
                message("Waiting for the current game to end...")
                localPlayer:WaitForChild('PlayerGui').TL.TextLabel.Text = "Waiting for the current game to end..."
            else
                message("There are enough players for a new game!  Teleporting...")
                localPlayer:WaitForChild('PlayerGui').TL.TextLabel.Text = "There are enough players for a new game!  Teleporting..."
                wait(5)
                teleportAllPlayers()

            end
        else
            message("Waiting for more players...")
            localPlayer:WaitForChild('PlayerGui').TL.TextLabel.Text = "Waiting for more players..."
        end
    end
end

located in StarterGui, when you hover over the GUI/imageubutton it will expand script :

SP = script.Parent

animDirection = "Out"
animStyle = "Back"
animSpeed = 0.2
animDeb = true
--

SP.MouseEnter:connect(function()
script.Parent:FindFirstChild("Sound"):Play()

SP:TweenSize(UDim2.new(0,100,0.05,SP.Size.Y.Offset), animDirection, animStyle, animSpeed, animDeb)

end)

SP.MouseLeave:connect(function()

SP:TweenSize(UDim2.new(0,85,0,SP.Size.Y.Offset), animDirection, animStyle, animSpeed, animDeb)

end)

&

SP = script.Parent

animDirection = "Out"
animStyle = "Back"
animSpeed = 0.2
animDeb = true
--

SP.MouseEnter:connect(function()
script.Parent:FindFirstChild("Sound"):Play()

SP:TweenSize(UDim2.new(0,100,0.07,SP.Size.Y.Offset), animDirection, animStyle, animSpeed, animDeb)

end)

SP.MouseLeave:connect(function()

SP:TweenSize(UDim2.new(0,85,0,SP.Size.Y.Offset), animDirection, animStyle, animSpeed, animDeb)

end)

When click script.parent then script.parent disappears isn't working in StarterGui

script.parent.MouseButton1Click:connect(function()
script.Parent.Visible = false
end)

3 comments

0

Well, I noticed something: You use "player.Character.Torso", but what if the player is in R15? it might be either UpperTorso or LowerTorso, you should check that.

0

^ Alright thanks!

0

Yeah, Try changing torso to UpperTorso or even Head if you can.

1 answer

✓ Accepted answer

The code doesnt work in a server because you used LocalPlayer which only works in a localscript, so maybe move the code to a localscript or use an alternative to LocalPlayer.

This discussion is preserved as it was. New answers, comments, and votes are closed.