Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When the user select a team, the system is not updating. Can anyone help?

I am trying to set two teams (thieves and police). The user can choose the team with GUI at the start of a game. When the user clicks on the GUI button for a team it does not work for some reason, and I am not getting any errors, can anyone help?

Thanks.

This is the local script located in the StarterGui:

-- Team changer GUI script
local remoteEvent = game.ReplicatedStorage.teamChanger
local teamGuiFrame = script.Parent:WaitForChild("Frame")

--Teams

local thieveColor = "Deep Orange"
local policeColor = "Deep Blue"

teamGuiFrame.ThieveButton.MouseButton1Click:Connect(function()
	remoteEvent:FireServer(BrickColor.new(thieveColor))
end)


teamGuiFrame.PoliceButton.MouseButton1Click:Connect(function()
	remoteEvent:FireServer(BrickColor.new(policeColor))
end)

And this is the serverSide script:

--Team Changer

game.ReplicatedStorage.teamChanger.OnServerEvent:Connect(function(player,teamColor)
	player.TeamColor = teamColor
	player:LoadCharacter()
end)

Here is the image of the Explorer: https://ibb.co/7KP8Jxd

2 comments

0

Are you receiving any errors in the Output window?

0

No, I am not getting any errors.

2 answers

For the local script on your 7th and 8th line, you've made a mistake for Deep orange and Deep blue, roblox is very sensetive with capitals, and you've used a capital for orange and blue, it may be that problem

-- Team changer GUI script
local remoteEvent = game.ReplicatedStorage.teamChanger
local teamGuiFrame = script.Parent:WaitForChild("Frame")

--Teams

local thieveColor = "Deep orange"
local policeColor = "Deep blue"

teamGuiFrame.ThieveButton.MouseButton1Click:Connect(function()
    remoteEvent:FireServer(BrickColor.new(thieveColor))
end)


teamGuiFrame.PoliceButton.MouseButton1Click:Connect(function()
    remoteEvent:FireServer(BrickColor.new(policeColor))
end)

1 comment

0

I tried it and still nothing.

Instead of trying to get the team color, get the team instead

It will probably look like this:

local script


local remoteEvent = game.ReplicatedStorage.teamChanger
local teamGuiFrame = script.Parent:WaitForChild("Frame")

local teamService = game:GetService(“Teams”)

local thieveTeam = teamService.Name_of_Thieve_Team
local policeTeam = teamService.Name_of_Police_Team

teamGuiFrame.ThieveButton.MouseButton1Click:Connect(function()
   remoteEvent:FireServer(thieveTeam)
end)
 

teamGuiFrame.PoliceButton.MouseButton1Click:Connect(function()
  remoteEvent:FireServer(policeTeam)
end)

Server Script

game.ReplicatedStorage.teamChanger.OnServerEvent:Connect(function(player,team)
 player.Team = team
 player:LoadCharacter()
end)

1 comment

0

Hopefully this works out for you

This discussion is preserved as it was. New answers, comments, and votes are closed.