of     1   

Utato
#139295902Saturday, July 05, 2014 7:20 AM GMT

I'm making a script where you click a GUI button it turns a light in your torso on and off. But whenever I click "off" it doesn't work. local player = script.Parent.Parent.Parent.Parent local bin = script.Parent function mb1d() local e = Instance.new("PointLight", player.Character.Torso) e.Name = "Light" e.Color = Color3.new(0, 0, 255) if (bin.Text == "Off") then bin.Text = "On" player.Character.Torso.Light.Enable = false else bin.Text = "Off" player.Character.Torso.Light.Enable = true end end bin.MouseButton1Down:connect(mb1d)
smiley599
#139297587Saturday, July 05, 2014 7:56 AM GMT

Isn't the property called Enabled, not Enable? Check :)
Sasayaki
#139298410Saturday, July 05, 2014 8:14 AM GMT

its because you're making a new light thats "On" every single time you push the button. And the script only affects the first light, so this will never turn off. heres a fix local player = script.Parent.Parent.Parent.Parent local bin = script.Parent local e = Instance.new("PointLight", player.Character.Torso) e.Name = "Light" e.Color = Color3.new(0, 0, 255) e.Enabled = false function mb1d() if (bin.Text == "Off") then bin.Text = "On" e.Enabled = false else bin.Text = "Off" e.Enabled = true end end bin.MouseButton1Down:connect(mb1d)
Utato
#139340835Saturday, July 05, 2014 7:36 PM GMT

@Waz Thanks.

    of     1