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

Script's broken. Please fix? (STILL NEED HELP)

Asked by 10 years ago

My script is supposed to make a baseplate where if you click a button it goes disco, and if you click off, it goes back to normal. The problem is it doesent do any of that. I don't think that it's registering the click.

local baseplate = game.Workspace.BasePlate
local on = false

function onClicked()
    on = true
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

function onClicked2()
    on = false
end

script.Parent.Parent.Off.ClickDetector.MouseClick:connect(onClicked)

if on == true then
    while true do
    baseplate.BrickColor = BrickColor.new("Bright red")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Bright violet")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Hot pink")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("New Yeller")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Lime green")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Really blue")
    wait(0.1)
    end
end 

if on == false then
    baseplate.BrickColor = BrickColor.new("Dark stone grey")
end

1 answer

Log in to vote
0
Answered by 10 years ago
Try this

local baseplate = game.Workspace.BasePlate
local on = false

function onClicked()
    on = true
end

function onClicked2()
    on = false
end


if on == true then
    while true do
    baseplate.BrickColor = BrickColor.new("Bright red")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Bright violet")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Hot pink")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("New Yeller")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Lime green")
    wait(0.1)
    baseplate.BrickColor = BrickColor.new("Really blue")
    wait(0.1)
    end
end

if on == false then
    baseplate.BrickColor = BrickColor.new("Dark stone grey")
end

script.Parent.Parent.Off.ClickDetector.MouseClick:connect(onClicked)
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Not 100% Sure if it will work, but give it a try.

0
Doesn't work. blockhaak2 1 — 10y
0
Sorry man ;/ WelpNathan 307 — 10y
Ad

Answer this question