Hello, I need help. I don't know how to check if player does not have light inside his torso already but it won't run the function, it seems like it can't check if its in it.
The script is:
return function() script.Parent.Touched:Connect(function(t) if not t.Parent.Torso.Glow then local glow = Instance.new("PointLight") glow.Name = "Glow" glow.Parent = t.Parent.Torso glow.Range = script.Parent.Range.Value or 16 glow.Color = script.Parent.GlowColor.Value or Color3.fromRGB(255, 255, 255) end end) end
Thanks for help!
You should detect something not exist by using FindFirstChild. Because if they detect nothing, they return nil.
Example:
local Glow = t.Parent.Torso:FindFirstChild("Glow") if Glow == nil then -- do what you want end