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

Script has an error in it and won't work. What's wrong with it? Am I not putting the color right?

script.Parent:WaitForChild("Arrest").OnServerEvent:Connect(function(plr, tarplr)
	if game:GetService("Players")[tarplr.Name].Guilty == true
	then
		game:GetService("Players")[tarplr.Name].Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Game.Spawns.Prisoner.Cell2.Position)
		game:GetService("Players")[tarplr.Name].TeamColor = Deep orange
	end
end)

On the 5th line, Deep orange is underlined as an error and it won't work. Help please? game:GetService("Players")[tarplr.Name].TeamColor =* Deep orange*

3 answers

✓ Accepted answer

Just writing out Deep Orange on it's own means absolutely nothing. Like Koch pointed out you need to wrap it between "" to make it a string however that isn't sufficient either. You need to get a BrickColor value to assign to your player his TeamColor:

game:GetService("Players")[tarplr.Name].TeamColor = BrickColor.new("Deep orange")

However additionally I want to point out that changing the TeamColor property on it's own might not be the best choice. Seeing as when the team colors could potentially change during the course of development. It'd be better to directly assign the .Team property of a player like this:

game:GetService("Players")[tarplr.Name].Team = game.Teams["your team name"]

3 comments

0

BrickColor for TeamColor?

0

It worked! Thank you!

hello!

For this to work, you need to use the color as a BrickColor, you can make that by using BrickColor.new()

script.Parent:WaitForChild("Arrest").OnServerEvent:Connect(function(plr, tarplr)
    if game:GetService("Players")[tarplr.Name].Guilty == true
    then
        game:GetService("Players")[tarplr.Name].Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Game.Spawns.Prisoner.Cell2.Position)
        game:GetService("Players")[tarplr.Name].TeamColor = BrickColor.new("Deep orange") -- You need to use the color(in this case) as a brick color
    end
end)

For more information about TeamColor, access the api:

https://developer.roblox.com/en-us/api-reference/property/Team/TeamColor

1 comment

0

Thx!

You must put it as a String.

3 comments

0

Can you explain a bit more?Where would I use the string?

0

Can I try "do = Deep orange"

0

orange is underlined as an error

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