#Tweening a Model through a Part

1 messages · Page 1 of 1 (latest)

bitter eagle
#

Hi everyone I'm a bit new to this Discord and to scripting, and I've been trying to Tween a model through a part. In this case, I want a model of a tree, grass, or bush to emerge through the baseplate. I've been struggling a lot, and I joined here to figure out how to fix it.

In the image I added, you can see that the Model just kinda sits there... I'm not even sure if it's trying to move!

Any help is appreciated. 🥹 (sorry if i posted too much, im not sure what to exclude)

local function PlaceClones(clone, x, z, height)
    local primaryPart = clone:FindFirstChild("PP")
    
    local tweenInfo = TweenInfo.new(
        1,
        Enum.EasingStyle.Elastic,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )
    
    local y = height / 2 + 2
    
    local properties = {
        ["Position"] = Vector3.new(x, 30, z),
    }
    
    local tween = TweenService:Create(primaryPart, tweenInfo, properties)
end

--Set the clone's position to prepare for the tween
local function CreateClones() --Create clones and store them
        for i = 1, spawnLimit - totalSpawns, 1 do --Create 500 clones
        --Set the clone's position to prepare for the tween
        local x, z = RollPositionXZ()
        
        local cloneHeight = clone:GetExtentsSize().Y
        local y = -cloneHeight / 2 - 2

        clone.PP.CFrame = CFrame.new(x, y, z)
        
        PlaceClones(clone, x, z, cloneHeight)
    end
end
golden kindle
#

tween:Play()

bitter eagle
# golden kindle you didnt play the tween

Silly me, I've added "tween:Play()". but now only the PrimaryPart moves and the other parts don't. have set WeldConnstraints from the PrimaryPart to every other part in the model, and the other parts are unanchored while the PrimaryPart is. Do you know any other way to fix this?

golden kindle
bitter eagle
#
local function PlaceClones(clone, x, z, height)
    local primaryPart = clone:FindFirstChild("PP")
    
    local tweenInfo = TweenInfo.new(
        1,
        Enum.EasingStyle.Elastic,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )
    
    local y = height / 2 + 2
    
    local properties = {
        ["Position"] = Vector3.new(x, y, z),
    }
    
    local cloneParts = clone:GetChildren()
    for _, part in pairs(cloneParts) do
        if part:IsA("BasePart") then
            local tween = TweenService:Create(part, tweenInfo, properties)
            
            tween:Play()
        end
    end
end
bitter eagle
golden kindle
#

you could make the properties table inside of the for loop and instead of making new vector
use the position of the part and increase it depending on where u want the model to go

bitter eagle