Universal Script 📌
10.9k Views
136 Executions

Change team

Universal Script 📌
anyara1919
anyara1919First script
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

The script for changing teams is as follows: 1 Enter the game team name to match the team name and run the script I don't know if it really works, you guys have to try it

View Raw
-- รายชื่อทีมที่สามารถเปลี่ยนได้
local teams = {
    ["Red"] = "Red Team",
    ["Blue"] = "Blue Team",
    ["Green"] = "Green Team",
    ["Yellow"] = "Yellow Team"
}

-- ฟังก์ชันเปลี่ยนทีม
local function changeTeam(player, teamName)
    local team = game.Teams:FindFirstChild(teamName)
    if team then
        player.Team = team
        player:LoadCharacter()  -- รีเซ็ตตัวละครเพื่อเปลี่ยนทีมทันที
        player:FindFirstChildOfClass("PlayerGui"):SetCore("ChatMakeSystemMessage", {
            Text = "You have been switched to " .. teamName;
            Color = Color3.new(0, 1, 0);
        })
    else
        player:FindFirstChildOfClass("PlayerGui"):SetCore("ChatMakeSystemMessage", {
            Text = "Invalid team name!";
            Color = Color3.new(1, 0, 0);
        })
    end
end

-- ฟังก์ชันดำเนินการเมื่อผู้เล่นพิมพ์ในแชท
local function onChatted(player, message)
    local args = string.split(message, " ")
    if args[1] == "/team" and args[2] then
        local teamName = teams[args[2]]
        if teamName then
            changeTeam(player, teamName)
        else
            player:FindFirstChildOfClass("PlayerGui"):SetCore("ChatMakeSystemMessage", {
                Text = "Invalid team name!";
                Color = Color3.new(1, 0, 0);
            })
        end
    end


Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!