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

Click detection doesn't do anything with my toggled conveyor. What is wrong?

Asked by
AdamTHM -1
5 years ago
-- sdd is the part where I want the texture to change and ConveyorRG is what I want for the velocity to be changed.



local works = false



script.Parent.Button.ClickDetector.MouseClick:Connect(function()

if works == false then

works = true

Parent.ConveyorRG.Velocity = Vector3.new(0,0,-1.4)

Parent.ConveyorRG.CanCollide = false

repeat

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668762" --2

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668788" --3

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668797" --4

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668806" --5

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668810" --6

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668819" --7

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668834" --8

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668847" --9

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668856" --10

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668870" --11

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668877" --12

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668884" --13

if frontdown == false then break end

wait()

Parent.sdd.Texture.Texture = "http://www.roblox.com/asset/?id=265668745" --1

until frontdown == false

end

end)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
local works = false
ClickDetector.MouseClick:Connect(function()
    if (not works) then
        works = true
        --stuff
        works = false
    end
end)

You need to set the variable works to false if you want it to run again. Otherwise it'll only work for the first click (assuming you want it to work multiple times).

Error codes would help us with the solution and context of your situation.

Ad

Answer this question