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

How do I move a brick on the X axis without it going up?

Asked by 7 years ago
Edited 7 years ago

I move a brick on the X axis, it works perfectly fine, but when it hits another brick, it moves up so that it's on top of the brick. I want it to go through the brick, how do I fix this? This is my script:

while true do
    wait(0.001)
    script.Parent.Position = script.Parent.Position + Vector3.new(0.275, 0, 0)
end

If you still don't know what I'm talking about, try this script yourself on a brick. Then put some parts in front of it. It will go on top of those parts once it hits them. I want the part to go through those other parts that it's running into.

0
Could you elaborate please? Also, if you can, include an example. ghostwalker13 2 — 7y
0
edit has been posted. orangebuddycrash 57 — 7y
0
... From what I can infer, you want your brick to continue moving Through Other Bricks on the x-axis? ghostwalker13 2 — 7y
0
yes. orangebuddycrash 57 — 7y
View all comments (3 more)
0
"through other bricks" use CFrame instead of Position Pejorem 164 — 7y
0
how would i write my script if i used CFrame? orangebuddycrash 57 — 7y
0
composed it as an answer Pejorem 164 — 7y

1 answer

Log in to vote
1
Answered by
Pejorem 164
7 years ago
local part = script.Parent
part.CFrame = CFrame.new(part.CFrame.X + 0.275. part.CFrame.Y, part.CFrame.Z)

Idk if there's a more efficient way of writing this but that should work

2
part.CFrame = part.CFrame + Vector3.new(0.275,0,0) would be simpler. RubenKan 3615 — 7y
Ad

Answer this question