I’m trying to create a PointLight object locally so that only the client see’s it. My script goes like this:
local Player = game:GetService("Players").LocalPlayer
function CreateLight()
local Light = Instance.new("PointLight")
Light.Brightness = 1
Light.Shadows = true
return Light
end
Player.CharacterAdded:Connect(function(Character)
local Light = CreateLight()
Light.Parent = Character:WaitForChild("Head")
end)
When I play test in studio, it works just fine; However when I get in game the PointLight object is created and put into the right spot, but it shows no light, it is enabled and in the correct spot but it doesn’t produce light.
Here are some details in my game that might be useful:
The camera stays 1600 studs away from the player, but I’m certain this isn’t directly causing it because I tried it with the camera at a regular distance.
The StarterCharacter has been changed, and the Head starts as transparent
Are you doing this in the day environment? It may be impossible to see the light if the game’s time is the day, not night. Did you also enable PointLight via Property Enabled? Make sure that it’s enabled. Otherwise, you can’t see the lighting effect.
I also recommend increasing the brightness and range. Very low brightness and range of the lighting is hard to perceive.
I tried implementing the PointLight you made. I see how you barely see the light coming out of the head. I recommend increasing the range. You must increase the range for the light to light within the field. If we were to have it as 10, the lighting range would light up a radius of ten. If the lighting’s radius is one, it’s barely visible and hardily any light is coming out.
it is possible that your character is created before the script runs. I’d suggest making a CharacterAddedFunction and set it up like this:
function characterAdded(Character)
local Light = CreateLight()
Light.Parent = Character:WaitForChild("Head")
end
Player.CharacterAdded:Connect(charcterAdded)
if player.Character then -- This will also run the function on an existing character
characterAdded(Player.Character)
end
This also can certainly be the problem. You are probably not rendering it from that far away, with different render settings between a live game vs studio.