anyone have a script for this
Posted by hi on Mar 29th 2023, 10:06PM
ok i need a script that when you touch the script's parent you get set to a specific team based on its name idk if its actually possible but soemeone please make it
Posted by TheOGRobloxian on Mar 31st 2023, 11:14AM
This is from roblox but you can try to see if it works...

Place the following script inside of the block, or sphere, or whatever other object - Make a new part for every team and copy-paste the same script just changing the team colour. For example, you have a "police" team, so you make the team let's say light blue and have this script inside of a block. Then you have a "military" team, which is neon green, or whatever other colour and put the same script inside of a new block, just changing the colour on the second line:


# in the second line change the 'BrickColor' to the colour of the team you want the player to become

local Enabled = true
local Team = BrickColor.new("your colour here")

script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
if Enabled == true then
Enabled = false
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
Player.TeamColor = Team
Enabled = true
end
end
end)
Posted by TheOGRobloxian on Mar 31st 2023, 11:16AM
Ignore the indentation errors here - brick planet did that ~_~
Originally posted by TheOGRobloxian on Mar 31st 2023, 11:16AM
Ignore the indentation errors here - brick planet did that ~_~
Posted by TheOGRobloxian on Mar 31st 2023, 11:16AM
*Brick Planet auto-ajusted the text
Posted by TheOGRobloxian on Mar 31st 2023, 11:18AM
And, before anyone says anything:
BP uses lua in a very similar way to Roblox, so in theory, scripts should be easy to carry over from one platform to another
Posted by elevator on Apr 5th 2023, 5:25PM
Here ya go (this one will like actually work lol)

-------------------------


-- set a team name variable

TeamName = "Team 1"

-- give it a color

TeamColor = PartColor.New(255, 0, 0) -- (R, G, B)

-- set a variable that goes to the brick

local TeamPart = Workspace.Brick

-- create the teams

Leaderboard.CreateTeam(TeamName, TeamColor)


-- make a function that sets the players team

local function setPlayerTeam(plr)
if plr.UserId then -- check if the touched part is a player
Leaderboard.SetPlayerTeam(plr, TeamName) -- set the players team when the function is fired
end
end

TeamPart.Touched:Connect(setPlayerTeam) -- connect the function to when a player touches the part