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

Can I use the property, 'TeamColor' in a server script?

Hello! I have been looking in a ton of places, but can't find any help for this. I have a server script with this code:

local ReplicatedStorage = game.ReplicatedStorage
local CreateEvent = ReplicatedStorage.Events:WaitForChild("CreateEvent")
local City = game.ReplicatedStorage.Cities.City

function Fired(plr)
	local char = plr.Character
	local leg = char["Left Leg"]
	local offset = Vector3.new(0, 0, 0)
	local Cloney = City:Clone()
	Cloney.Parent = workspace
	Cloney:MoveTo(leg.Position + offset)
	if plr.TeamColor == "Shamrock" then
		Cloney.CityBase.BrickColor = BrickColor.new("Shamrock")
	elseif plr.TeamColor == "Maroon" then
		Cloney.CityBase.BrickColor = BrickColor.new("Maroon")
	end
end

CreateEvent.OnServerEvent:Connect(Fired)

I am still working on the offsets and other things in this script, so don't judge. I tried using

BrickColor.new(plr.TeamColor) 

and that didn't work either, but it will work in a local script. Any help is appreciated!

3 comments

0

is this the entire script? i need to see more of the script to help

0

Yes, it's the entire thing.

0

maybe you can try cloney.citybase.BirckColor=plr.TeamColor

1 answer

✓ Accepted answer

###The TeamColor property is not a string, it is a BrickColor value. You use it in conditionals like this:

if plr.TeamColor == BrickColor.new("Shamrock") then

###To assign:

plr.TeamColor = BrickColor.new("Shamrock")

3 comments

0

Ohhh haha. Thank you. That helps a TON. I forgot TeamColor wasn't a string.

0

How do I mark this as answered? I'm new to this website.

0

You click the Check mark next to his Answer! :D

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