Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

Get rid of the do. :P (Line 6)

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.