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

How do I make a script test if a boolvalue is true?

Asked by 6 years ago

Hello, I would like to make a script test if a bool value is true or false. if is false then end and repeat but if it is true it would activate the c-frame.

Here is what I wrote.


if game.Workspace.Arm.Begin.Value == false then end if game.Workspace.Arm.Begin.Value == true then do distance = 5 for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame-Vector3.new(1,0.0,0) wait(00.010) end for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(1,0.0,0) wait(00.010) end
0
Get rid of the `do`. :P (Line 6) TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Ok so the only error was that you have to get rid of the "do" on line 6 so the code will be

if game.Workspace.Arm.Begin.Value == false
    then
end


if game.Workspace.Arm.Begin.Value == true then 

    distance = 5 
for i = 0, distance do
script.Parent.CFrame = script.Parent.CFrame-Vector3.new(1,0.0,0) 
wait(00.010)
end

for i = 0, distance do
script.Parent.CFrame = script.Parent.CFrame+Vector3.new(1,0.0,0) 
wait(00.010)

end
Ad

Answer this question