Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so when touched, your leaderstats change?

Asked by 3 years ago

I have a game show, and on the leaderboard it shows your group rank. But I want it so when you touch a block, it will change your rank leaderstat to a color, specifically the color of the team you're joining. Can anyone help?

1 answer

Log in to vote
0
Answered by 3 years ago

If you want a player to touch a block and change team, I would recommend using SpawnLocations as Roblox already has this feature.

What you would do is that you would first create 2 teams(you can create as many as you want, this is just an example).

Go to the teams folder, it is right below StarterPlayer.

Then create two teams.

Name a team, "RedTeam" and the other, "BlueTeam".

For the red team, set the team color to a red color, any color is fine. Do the same for the blue team.

Then put in two spawn locations onto workspace.

Then in each of the spawn locations, scroll down all the way in it's property tab and set AllowTeamChangeOnTouch to true, and set the color to the same exact color as the color on the two teams in teams folder.(THIS IS IMPORTANT!).

If you don't want any neutral team, then select the neutral option and set it to false.

Now you have two teams. Feel free to add as many teams as you can.

If you have any questions, feel free to ask.

If case you are a bit confused(I am not the best explainer). Here is a script for you that does the exact same thing of what I have previously said.

local Teams = game:GetService("Teams")


--Create 2 Teams
local RedTeam = Instance.new("Team")
RedTeam.Name = "RedTeam"
RedTeam.TeamColor = BrickColor.new("Really red")
RedTeam.Parent = Teams

local BlueTeam = Instance.new("Team")
BlueTeam.Name = "BlueTeam"
BlueTeam.TeamColor = BrickColor.new("Really blue")
BlueTeam.Parent = Teams

--Create Spawn Locations
local RedTeamSpawn = Instance.new("SpawnLocation")
RedTeamSpawn.BrickColor = RedTeam.TeamColor --Set color for identification purposes.
RedTeamSpawn.AllowTeamChangeOnTouch = true
RedTeamSpawn.Neutral = false
RedTeamSpawn.TeamColor = RedTeam.TeamColor
RedTeamSpawn.Parent = workspace

local BlueTeamSpawn = Instance.new("SpawnLocation")
BlueTeamSpawn.BrickColor = BlueTeam.TeamColor --Set color for identification purposes.
BlueTeamSpawn.AllowTeamChangeOnTouch = true
BlueTeamSpawn.Neutral = false
BlueTeamSpawn.TeamColor = BlueTeam.TeamColor
BlueTeamSpawn.Parent = workspace
Ad

Answer this question