How can I make a skip stage button work for a team stage system?

hey I am working on an adventure style parkour game and I am trying to make a skip stage button work with my team stage system see the photo if your confused does anyone know how I would do this? all the things I have tried failed thanks!!

Screen Shot 2021-10-19 at 10.51.56 am|399x433

Use this:

LocalScript

local button = --Put here your skip stage button
local remoteEvent = --Put here a RemoteEvent within ReplicatedStorage

button.Activated:Connect(function()
	remoteEvent:FireServer()
end)

Script

local remoteEvent = --Put here a RemoteEvent within ReplicatedStorage
local teams = game:GetService("Teams"):GetChildren()

remoteEvent.OnServerEvent:Connect(function(player)
	local stage = table.find(teams, player.Team)
	player.Team = teams[stage + 1]
end)
1 Like

Cool thanks where exactly am I supposed to put the script? I think I got an idea but just double checking

also right now all my check points are named Checkpoint 1, Checkpoint 2, ect do I need to change the names for the script to work?

If you want :slight_smile: (or you can just use tags), I had to do that once when I decided everything should be put in one script :). Also, I suggest setting the player’s “RespawnLocation” to create checkpoints instead of creating lots of “Teams” because colors are limited :).

1 Like

alright thanks I like the teams thing because it looks better in my opinion but it seems a lot harder to work with so maybe I will do that instead

I know this makes me seem like such I noob but what do you mean by tags?

I’ve never used tags before :slight_smile: but I think some people use it to assign a “second name” to an object. This link will help you more than I can: CollectionService :slight_smile: