How would I make this flashlight stick to the chest of a player?

So in the image we have a light we put on this NPC’s chest except we don’t know how to make it stick to a player when they’re walking, any help is apreciated!

You could simply parent the light to the NPCs head itself? I’m not sure if this is quite what you mean.

Another way you could do it is to have a script that constantly sets the CFrame of the part the light is patented to, to the CFrame of the NPCs RootPart.

I’m trying to stick it to the actual player, the npc was an example. I don’t really know how i’d go about putting it on the player in the first place.

Oh okay, right. In that case, you could have a script in StarterCharacterScripts that creates a Spotlight and parents it to the characters head:

local char = script.Parent
local light ="Spotlight")
light.Name = "Flashlight"
light.Parent = char:WaitForChild("Head")

You can also store a light somewhere else and clone it if you want to change a lot of properties, but this is how you would put a light in the players head.

Note however that the flashlight will point in the players head direction but will not go up or down unless you have a separate part that follows the cameras Cframe

1 Like