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

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

Asked by 6 years ago

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!

0
is this the entire script? i need to see more of the script to help Zendaya774isstupid 50 — 6y
0
Yes, it's the entire thing. xXDoneBeingCoolXx 33 — 6y
0
maybe you can try cloney.citybase.BirckColor=plr.TeamColor Zendaya774isstupid 50 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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")
0
Ohhh haha. Thank you. That helps a TON. I forgot TeamColor wasn't a string. xXDoneBeingCoolXx 33 — 6y
0
How do I mark this as answered? I'm new to this website. xXDoneBeingCoolXx 33 — 6y
0
You click the Check mark next to his Answer! :D Enomphia 39 — 6y
Ad

Answer this question