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

My Brick moving by CFraming doesnt work?

Asked by 8 years ago

So what happens is, my brick moves every 10 seconds and only by a little bit. It seems like it skips the FOR loop and goes right ahead instead of finishing the function. I dont know whats going on and i need help, please :)

while true do
wait(10)
    if game.Workspace.MainScript.Open == true then
        for i = 0, 55 do
        wait()
        script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 0.5)
        end
    end
end
1
your problem seems to be line 3. Is "Open" a value type, BoolValue, i mean? If so, after MainScript.Open add .Value rollercoaster57 65 — 8y

3 answers

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

You need to index the Value property of ValueObjects to reference it's value! You did not do so on line 3.

--You can just add the wait function in the definition of the while loop
while wait(10) do
    --Index 'Value'. '== true' is redundant.
    if workspace.MainScript.Open.Value then
        for i = 0, 55 do
            wait()
            script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 0.5)
        end
    end
end
Ad
Log in to vote
0
Answered by 8 years ago

I believe that it's skipping because ".Open" is not a proper property of a script. If not, maybe it's because the Vector3 portion isn't using "i", so it won't move with the for loop. Anyway, I hope you find the answer!

0
MainScript contains a BoolValue called Open Alucifer 45 — 8y
Log in to vote
0
Answered by 8 years ago

Nevermind I solved the problem by using the for i, v loop :)

Answer this question