1. BrickPlanet Forum
  2. Game & Scripting Discussion
  3. anyone have a script for this
anyone have a script for this
hi
Level 11
Joined Nov 12th 2022
Posts 90
Posted Mar 29th 2023 at 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
TheOGRobloxian
Level 8
Joined Mar 22nd 2023
Posts 253
Posted Mar 31st 2023 at 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)
TheOGRobloxian
Level 8
Joined Mar 22nd 2023
Posts 253
Posted Mar 31st 2023 at 11:16AM
Ignore the indentation errors here - brick planet did that ~_~
TheOGRobloxian
Level 8
Joined Mar 22nd 2023
Posts 253
Posted Mar 31st 2023 at 11:16AM
Originally posted by TheOGRobloxian on Mar 31st 2023 at 11:16AM
Ignore the indentation errors here - brick planet did that ~_~
*Brick Planet auto-ajusted the text
TheOGRobloxian
Level 8
Joined Mar 22nd 2023
Posts 253
Posted Mar 31st 2023 at 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
elevator
Level 6
Joined Jan 12th 2023
Posts 20
Posted Apr 5th 2023 at 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
59
Level 9
Joined Nov 20th 2022
Posts 74
Posted Apr 26th 2023 at 10:06AM
waltuh
EllernateFan
Level 14
Joined Dec 9th 2022
Posts 4,337
Posted Apr 26th 2023 at 6:29PM
waltuh omg
EllernateFan
Level 14
Joined Dec 9th 2022
Posts 4,337
Posted Apr 26th 2023 at 6:30PM
Walter white!,!,

Search Forum

Thread Info

Replies
8
Views
58
Created Mar 29th 2023
Last Reply Apr 26th 2023