Universal Script 📌
10.9k Views
189 Executions

Change team

Universal Script 📌
anyara1919
anyara1919First script
3 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

Updates

  1. Script edited: Create script

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!

More universal scripts

See all
Script hub
272
312
Bumped 33 minutes ago

Script hub

Blythe

Script hub
8.9k
55.1k
Bumped 1 hour ago
Key System
Script hub
500
6.4k
Bumped 5 hours ago
Key System
Universal Script 📌
7.2k
104.7k
Bumped 7 hours ago
Script hub
509
2.1k
Bumped 8 hours ago
Key System
Universal Script 📌
207
174
Approved 10 hours ago
Universal Script 📌
315
2.5k
Approved 11 hours ago