How would I place a PointLight onto the player's head?

Pretty self-explanatory, I want to have the player contain a PointLight on their head to act as a light for a maze I’m working on, and I have no idea how I would do that, so any method is good.

Any help is appreciated!

If you mean like a model of a point light on the player’s head, then I would just, when the player joins the game, put the point light model on its head. The model should have a small point light in it that makes sufficient light to see in the maze. Maybe a code like this would be good:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local your_Light_Model = ReplicatedStorage.Your_Light_Model

local function addModel(player)
    local Character = player.Character
    --// Just the code for cloning the light and setting the parent as the head 
    --// Note: Everything must be CanCollide false
end

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        addModel(player)
    end)
end)

Hope this helped.

Would This be the correct use? I’m not too good at scripting.

local your_Light_Model = ReplicatedStorage.Your_Light_Model:Clone()

local function addModel(player)
	local Character = player.Character
	your_Light_Model.Parent = Character.Head

Or would It be like this,

local your_Light_Model = ReplicatedStorage.Your_Light_Model:Clone()

local function addModel(player)
	local Character = player.Character
	your_Light_Model.Parent = Character:FindFirstChild("Head")

Yeah, the second option would be better because it uses FindFirstChild , but I’d recommend using WaitForChild instead. Just keep in mind that the model needs to be unanchored.

1 Like

Thanks! I’ll mark it as a solution, but just in case another person stumbles upon this with a similar issue, The PointLight only works if it is specifically defined in the script, for example,

local your_Light_Model = ReplicatedStorage.PointLight:Clone()

Putting it inside of a Model does not work, neither will placing it inside a part in the model.

Thanks for the help! :hugs:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.