local Players = game:GetService("Players")
local player = Players.LocalPlayer
player.CharacterAdded:Connect(function(character)
task.wait(1)
local head = character:WaitForChild("Head")
local light = Instance.new("PointLight")
light.Name = "AttachedLight"
light.Range = 50
light.Brightness = 30
light.Color = Color3.new(1, 1, 1)
light.Parent = head
end)
#Light object not showing up via local script
1 messages · Page 1 of 1 (latest)
@rough grail what do you think will happen to this script wehn the character loads before the local script?
I already accounted for that and added task.wait
Inside the function?
Yes? Or does task.wait doesn't work in functions?
`local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded()
task.wait(1)
local head = character:WaitForChild("Head")
local light = Instance.new("PointLight")
light.Name = "AttachedLight"
light.Range = 50
light.Brightness = 30
light.Color = Color3.new(1, 1, 1)
light.Parent = head`
Now this work
Because the character that you are passing in might not have loaded so even when I waits it still doesn’t work
Oh, just removing the function makes sensei guess, since local script runs as soon as player joins
Yk
Thank you
np
I was trying my best to teach him and he just sends the whole script
Oh, my bad sorry
I still dont think he fully understood why this isnt working
hello