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

How to change color of overhead gui after switching teams?

Asked by 3 years ago
Edited 3 years ago

Hi. In my game I have an event that changes a person's team when they click on a text button in a main menu gui when they start the game. It looks like:

-- in serverscript

local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") 

event.OnServerEvent:Connect(function(player,teamName)

local character = player.Character or player.CharacterAdded:Wait()

if character then

player.TeamColor = game:GetService("Teams"):FindFirstChild(teamName).TeamColor

wait(0.25)

player:LoadCharacter()

end

end)
--in local script

local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

script.Parent.MouseButton1Click:Connect(function()

local teamName = "Player"

event:FireServer(teamName)

end)

I have a second button that has the teamName as "Watcher". Is there a way to make an overhead gui that can be changed to either team color if a player dies or wants to switch teams later on in the game by pressing a button. For example, if a person is on team "Player" and the team color is red, then the text color of the overhead gui would be red. If they die or hit a button to become a "Watcher", how would I change the text color of the overhead gui to the team color and vice versa if a watcher wanted to become a player? I hope this makes sense. Thank you in advance.

0
Please use code blocks EiOooAxea 70 — 3y

Answer this question