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

How to add a position and change to "Spot Light"?

Asked by 10 years ago
local LightPart = workspace.Park
script.Parent.MouseButton1Click:connect(function()
    if LightPart:findFirstChild(LightPart.Name..'Light') then
        LightPart:findFirstChild(LightPart.Name..'Light'):Destroy()
        script.Parent.Text = 'Press to turn light on'
    else
        local light = Instance.new("PointLight", LightPart)
        light.Name = LightPart.Name..'Light'
        light.Range = 30
        light.Color=Color3.new(27/255,160/255,189/255)
        script.Parent.Text = 'Press to turn light off'
    end
end)

What do I need to edit to this to make it a Point light instead of a spot light and a different position eg, back,front,left. When I have tried it gliched he whole script and whatever is after the "else" stopped working.

0
It might be easier to just alter the enabled property of the light. GoldenPhysics 474 — 10y
0
Its a gui light so it just generates itself and deletes itself. @Golden is there a way I can change it so it just disables/enables besides delete and then generate? ScriptQuestions 0 — 10y

Answer this question