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

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

Asked by 3 years ago
Edited 3 years ago

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

0
Are you receiving any errors in the Output window? COUNTYL1MITS 312 — 3y
0
No, I am not getting any errors. badcraftyt 21 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

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)

0
I tried it and still nothing. badcraftyt 21 — 3y
Ad
Log in to vote
0
Answered by
1JBird1 64
3 years ago

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)
0
Hopefully this works out for you 1JBird1 64 — 3y

Answer this question