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

I ran into this problem. I don't have enough knowledge to fix it. Can you help me?

Asked by 5 years ago

So, i've made a game containing a cube, and some arrows. I've programmed the cube to move in different directions when i touch the same arrows. I wanted to add a score, but when i tried adding small yellow cubes i ran into a problem. Cause the cube has a script for each direction that goes something like this.

while true do
    script.Parent.Position = script.Parent.position + Vector3.new(-1,0,0)
    wait(0.10)
end

It also contains a bunch of other stuff, but that is irrelevant. The point is that when my cube hits another block, instead of going trough it, the cube goes above it, and then continues in the previous direction. I tried to fix this by turning CanColide off on the small yellow cube. This made my cube able to go trough it easily. But when i tried to add a onTouch function the the small cube, it went back to my old problem, where my cube would just go above the object instead of going trough it.

The reason why i want the cube to go trough the small yellow cubes is because i want the small yellow cubes to delete themself, and then add some points to my score. I don't know how to fix it, so i hope i can get some help.

:)

1 answer

Log in to vote
1
Answered by
joeldes 201 Moderation Voter
5 years ago

The issue you are experiencing is something I dealt with while making a sliding door for a client a while back.

The problem is, that you are using .Position to move the part. I am not 100% sure why this is the issue but I just know that for me, what solved the problem was CFrame.

To fix this you must translate the part using CFrame and not Position.

Here is an article: http://wiki.roblox.com/index.php?title=CFrame

0
Thank you so much. I'll look into it. If i could like your answer, i would have. :) Victorhjelmberg 11 — 5y
0
You could probably accept it as correct joeldes 201 — 5y
Ad

Answer this question