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

Problem with Vector3 and size?

Asked by 8 years ago

I am trying to make a brick that grows and kills you if you touch it, but I'm having a problem with Vector3.new() making it so if I walk into it, the part goes above me. Can you tell me why? BTW the part has CanCollide set to false, but I believe the problem is with the touchinterest that the kill script creates.

1 answer

Log in to vote
1
Answered by
XAXA 1569 Moderation Voter
8 years ago

Every time you try to change the size of the part, it changes its position so that it doesn't intersect (collide) with another part. To make the part stay in place, simply reset its CFrame every time you resize it. Simply resetting its Position would not do.

local part = script.Parent -- the part itself
local origcf = part.CFrame -- original CFrame of the part

--TO-DO: The rest of the script

function grow() -- function that grows the block
    while wait() do
        --TO-DO: Increase the size of the part every iteration of the loop
        part.CFrame = origcf -- reset the CFrame of the part every iteration
    end
end
Ad

Answer this question