Help with moving brick?
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
01 | if game.Workspace.Value.Value = = true then |
03 | for p = 100 , 50 , - 1 do |
04 | script.Parent.Position = Vector 3. new( 102 , 0.59 , p) |
09 | script.Parent.Position = Vector 3. new( 102 , 0.59 , p 1 ) |
13 | until game.Workspace.Value.Value = = false |
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
1 | script.Parent.ClickDetector.MouseClick:connect( function () |
2 | if game.Workspace.Value.Value = = true then |
3 | game.Workspace.Value.Value = false |
5 | if game.Workspace.Value.Value = = false then |
6 | game.Workspace.Value.Value = true |
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