Im making a button that makes a brick move or if its moving when i click on it it stops
this is the script that goes in the brick that its supposed to move
if game.Workspace.Value.Value == true then
repeat
for p = 100, 50, -1 do
script.Parent.Position = Vector3.new(102, 0.59, p)
wait()
end
wait(3)
for p1 = 50, 100 do
script.Parent.Position = Vector3.new(102, 0.59, p1)
wait()
end
wait(3)
until game.Workspace.Value.Value == false
end
This script works, if the value of Value is true it moves and if its false it doesnt move Also one thing, when the value of value is false and i change it to true the brick doesn't move
This is the script that goes in the button
script.Parent.ClickDetector.MouseClick:connect(function()
if game.Workspace.Value.Value == true then
game.Workspace.Value.Value = false
end
if game.Workspace.Value.Value == false then
game.Workspace.Value.Value = true
end
end)
That is script doesn't work
When i click on it when the Value of Value is true it has to change the Value of Value to false so the brick stops moving
And if the Value of Value is false its has to change the Value to true so the brick moves
What can i do so the script of the button actually changes the Value of Value so the brick stops or moves?
also Value is a boolvalue that i have on workspace

1 comment
Please help