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

Help with moving brick?

Asked by 10 years ago

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

0
Please help jorge5879 5 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

I have a better way so use the .Clicked function so when it is clicked and when the button goes up that function to add a body velocity to the part and adjust the CFrame (or what ever it is called) to your specific moments I will post the script later on how it would go. Also you position would be wrong people the position is the specific place on the map which it would not locate to the person and would just go to the direct position instead of the person

Ad

Answer this question