Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Insert PointLight Into The Player Lua Form?

Asked by 10 years ago

Here's the script:

game.Players.PlayerAdded:connect(function(player)
L = Instance.new("PointLight", Players.LocalPlayer.Torso)
end)

for _, player in pairs(game.Players:GetPlayers()) do
PlayerAdded() --- Where I'm Stuck At. Halp D:
end                                                

I am basically trying to get the PointLight inside the player so they can be bright. I have checked everything I did:

  • It is in a local script
  • It is in a StarterPack

The only part I am stuck on Line 6. Can anyone help me please?

2 answers

Log in to vote
0
Answered by
jav2612 180
10 years ago

I'm not sure if this is exactly what you want, but this will insert a light in every character's torso that spawns.


function Spawned(char) L = Instance.new("PointLight", char.Torso) end function PlayerAdded(player) player.CharacterAdded:connect(Spawned) end game.Players.PlayerAdded:connect(PlayerAdded)
0
I don't know if it worked but the output only said in red letters: 16:15:39.338 - Plugin_142731176._Char:15: attempt to index local 'myPlayer' (a nil value). What does that mean? DesignerDavid 0 — 10y
0
That isn't an error associated with this script.... That error is from some plugin you have that is not working correctly and has nothing to do with this. jav2612 180 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Lol'd at, easy

game.Players:PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local point = Instance.new("PointLight", char.Torso)
point.Range = 40
point.Brightness = 50
end)
end)
0
Ikr systematicaddict 295 — 10y

Answer this question