What do you want to achieve? Keep it simple and clear!
I added a highlight to StarterCharacterScripts, but I want the color of the highlight to change to the team color that the player is on.
What is the issue? Include screenshots / videos if possible!
The outline color doesn’t change at all.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking around and didn’t find anyone with the same issue. I Used the print function to test and it still printed.
Current code
wait(3)
local outlinec = script.Parent.OutlineColor
local team = game:GetService("Players").LocalPlayer.TeamColor.Color
outlinec = team
print("working?")
Also kinda a preference but I’d like to organize your code a bit
local Player = game.Players.LocalPlayer
script.Parent.OutlineColor.FillColor = Player.Team.Color
The reason I didn’t set a variable for OutlineColor and Team is because it seems like you’re only gonna be using it once. You don’t have to sue this but I just thought that I should fix / clean it up a bit for you.
But with the player, you might use it for other purposes if this LocalScript will contain other code so yeah
So outlinec is the highlight’s outline color. I want to change the outline color, not the fill color. The script I posted isn’t changing the color, but it’s still printing the print function i put in it.
You’re actually saving the current color of the Highlight. You’re not referencing the OutlineColor property.
So when you did this:
outlinec = team
The (compiler) was reading this:
White = team
More in depth if you understood the above:
Basically, when you were assigning script.Parent.OutlineColor, you thought that the variable would be holding a reference to the OutlineColor property.
But instead, it was actually just holding the value of the OutlineColor property.
Only when you’re assigning a new value to the property (without the use of a variable referencing the property) will it actually be referencing the property.
An example of this could be the Team color, your saving the value of the Team color to ”team” to a variable and when you used it, it changed the color to the Team’s color right?
Yeah, but if you try to change it, you’d assign it (with =) and it would be referencing like this;
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
-- do your cloning stuff here
end)
end)
basically every time a new player joins, the PlayerAdded event will fire and then all you gotta do is just do the cloning and assigning on the server
I’d recommend you keep the highlight in ReplicatedStorage and ya just clone the highlight and parent it to the player