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

SpotLight Color the Color of Players Head?

So this is the script I have. It has some other stuff in it but I'm confused on the spotlight.color thingy. If you find any other errors with the scripts feel free to tell me :D

wait()
player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
SpotLight = Instance.new("SpotLight", player.Character.Head)
SpotLight.Brightness = (.85)
SpotLight.Angle = (120)
SpotLight.Color = player.Character.Head.Color

3 answers

✓ Accepted answer

Parts don't have Colors, instead they have BrickColors.

wait()
player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
SpotLight = Instance.new("SpotLight", player.Character.Head)
SpotLight.Brightness = (.85)
SpotLight.Angle = (120)
SpotLight.Color = player.Character.Head.BrickColor

2 comments

2

Hmm okay Thanks :) I new it was something simple.

0

Yeah. Usually guis and lights use Color3 values. 3D guis and parts use BrickColors usually.

Instead of "Color", you need to use the function BrickColor(), which returns the color of the part. (Sorry if I am wrong about it being a function, but I'm pretty sure you would need to use player.Character.Head.BrickColor())

EDIT: Sorry, it's not a function, so just remove all the parentheses in my example, so it should be player.Character.Head.BrickColor

A part's color is made up of a BrickColor. A spotlight's color is made up of a Color3. Basically what you need, is a way of grabbing the part's BrickColor, and somehow get a Color3 out of that. Luckily, ROBLOX makes this quite simple, by adding a Color property to BrickColor. This means that you would only have to use player.Character.Head.BrickColor.Color to get the Color3 value out of the part!

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