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

Why does my ball go on top of of my box when resizing with a script?

Asked by 6 years ago

I have this ball I need to resize only by a script. It is inside of a box. But whenever it is being resized by the script, it goes on top of the box? The ball is non-collidable and anchored. I'm betting this has something to do with ROBLOX's physics

local ball = game.Workspace.Ball
local db = true

script.Parent.Touched:Connect(function()
    if not db then
        return 
    end

    db = false

    for i = 1,25 do
        ball.Size = Vector3.new(i,i,i)
        wait(0.05)
    end

    wait(1)
    db = true

end)

The box is 5x5x5 and the ball is 1x1x1.

Why does the ball not go through the box?

1 answer

Log in to vote
0
Answered by
Tomstah 401 Moderation Voter
6 years ago

This is an issue with, like you said, ROBLOX Physics. There are a few ways to get around this. One is (if it is non-collidable and anchored) store the position of the ball in a variable, then "teleport" the ball back to it's old position after resizing it. If this doesn't work, I recommend using CFrames instead.

0
I tried that and it didn't work so i will try CFrames MusicalDisplay 173 — 6y
0
CFrames will work for sure. Tomstah 401 — 6y
Ad

Answer this question