local lightingFolder = game.Workspace:WaitForChild("Lanterns")
if lightingFolder then
for _,Lantern in ipairs(lightingFolder:GetChildren())do
Source = Lantern:WaitForChild("Light")
--Source.PointLight.Enabled = not Source.PointLight.Enabled
--Instancing proximityprompt inside lights
Prompt = Instance.new("ProximityPrompt",Source)
Prompt.Exclusivity = "OneGlobally"
Prompt.HoldDuration = .5
Prompt.KeyboardKeyCode = "Q"
Prompt.MaxActivationDistance = 10
Prompt.ObjectText = "Light"
Prompt.ActionText = "Toggle"
Prompt.Triggered:Connect(function()
Prompt.Parent.PointLight.Enabled = not Prompt.Parent.PointLight.Enabled
if Prompt.Parent.PointLight.Enabled == false then
Prompt.Parent.Material = Enum.Material.SmoothPlastic
Prompt.Parent.Color = Color3.fromRGB(27,42,53)
else
Prompt.Parent.Material = Enum.Material.Neon
Prompt.Parent.Color = Color3.fromRGB(171,120,86)
end
end)
end
end
Hey I’m just getting into scripting and am having issues with my lantern script system. While my script does insert the proximity prompts properly into each source actually triggering the prompt at any lantern will only affect one single lantern rather than their parent lantern