How can I make a model move between two bricks?

I am building an Obby and I want this model to go between two bricks, but I’m a noob to scripting.

I know I could just use coordinates but I keep trying and it doesn’t work. I also think it would be easier to put obstacles together if I did it this way.

also here is the game I’m making - Its far from finished:
(Journey - Obby (BETA) - Roblox)

2 Likes

use

1 Like

oh, thanks. i will come back if i have any problems.

1 Like

Check out tween service or CFrame:Lerp()

1 Like

CFrame and TweenService should be able to solve the issue.

1 Like

yea I cant figure it out, as I mentioned I’m new to scripting.

Don’t know if it helps but when I first taught myself tween service (which was one of the first things I learned scripting wise) this video by Alvin Blox helped a ton:

2 Likes

Thanks! I will check it out. thank you all for the help!

local tweenSeRVICE= game:GetService("TweenService")
local part=script.Parent--the part you want to tween

--position the part start from
local startPosition=Vector3.new(-36.898, 12.051, -3.75)

--position the part goes to
local  endposition=Vector3.new(-74.164, 12.051, -3.75)

--info about tween
local tweenInfo = TweenInfo.new(
    2, -- Time for the whole tween to finish
    Enum.EasingStyle.Linear, -- EasingStyle https://developer.roblox.com/en-us/api-reference/enum/EasingStyle
    Enum.EasingDirection.Out, -- EasingDirection https://developer.roblox.com/en-us/api-reference/enum/EasingDirection
    0, -- RepeatCount (when less than zero the tween will loop indefinitely)
    false, -- Reverses (tween will reverse once reaching it's goal)
    0 -- DelayTime
)

--tween need a goal
-- use same property names such as Size, Positiom, CFrame, Rotation

--two variables 1 for the start position goal
goaltostart={
    Position=startPosition
}

--anotehr for the 2nd position the end position
goaltofinish={
    Position=endposition
}

--setup variables for the two gaols above
--tween to move part to the 1st position
tweentostart=tweenSeRVICE:Create(part,tweenInfo,goaltostart)

--tween to move part to the 2nd position
tweentofinish=tweenSeRVICE:Create(part,tweenInfo,goaltofinish)


tweentostart:Play()
while wait()do--while loop so that it keeps going without stopping
    tweentostart.Completed:Connect(function()--.completed will be called when the given tween stops
        tweentofinish:Play()--when the tween tweentostart stops play tweentofinish
    end)
    wait()
    tweentofinish.Completed:Connect(function()--.completed will be called when the given tween stops
        tweentostart:Play()--when the tween tweentofinish stops play tweentostart
    end)
end

4 Likes

Does it need to be unanchored? its not working

no u need to anchor everything and place the script directly into part
also change the start and end position
not local script

you will have 2 position u want the part to move to
move the part to one location and copys its position and insert it into
local startPosition=Vector3.new(-36.898, 12.051, -3.75)–Vector3.new(here)

move the samepart to another location and copy its position and insert it into
local endposition=Vector3.new(-74.164, 12.051, -3.75)–Vector3.new(here)

2 Likes

wait nvm im dumb you put it already
lol

dont edit gaolttostart or gaoltofinish

i already pasted the coords and it didnt work, is it because the thing im trying to move is a model?

you need to weld all the parts together

local tweenSeRVICE= game:GetService("TweenService")
local part=script.Parent--the par you want to tween

--positionthe part start from
local startPosition=CFrame.new(-33.264, 11.835, -6.895)

--positionthe part goes to
local  endposition=CFrame.new(-77.438, 11.835, -6.895)

--info about tween
local tweenInfo = TweenInfo.new(
    2, -- Time for the whole tween to finish
    Enum.EasingStyle.Linear, -- EasingStyle https://developer.roblox.com/en-us/api-reference/enum/EasingStyle
    Enum.EasingDirection.Out, -- EasingDirection https://developer.roblox.com/en-us/api-reference/enum/EasingDirection
    0, -- RepeatCount (when less than zero the tween will loop indefinitely)
    false, -- Reverses (tween will reverse once reaching it's goal)
    0 -- DelayTime
)

--tween need a goal
-- use same property names such as Size, Positiom, CFrame, Rotation

--two variables 1 for the start position goal
goaltostart={
    CFrame=startPosition
}

--anotehr for the 2nd position the end position
goaltofinish={
    CFrame=endposition
}

--setup variables for the two gaols above
--tween to move part to the 1st position
tweentostart=tweenSeRVICE:Create(part,tweenInfo,goaltostart)

--tween to move part to the 2nd position
tweentofinish=tweenSeRVICE:Create(part,tweenInfo,goaltofinish)


tweentostart:Play()
while wait()do--while loop so that it keeps going without stopping
    tweentostart.Completed:Connect(function()--.completed will be called when the given tween stops
        tweentofinish:Play()--when the tween tweentostart stops play tweentofinish
    end)
    wait()
    tweentofinish.Completed:Connect(function()--.completed will be called when the given tween stops
        tweentostart:Play()--when the tween tweentofinish stops play tweentostart
    end)
end
3 Likes

i could just make it a random floating brick but i wanted it to include the jet with fire coming out the bottom to add some realism.

2 Likes

Weld all parts to one certain part and insert the script in to that part
go to models tab and find create option and click on it
in there find Weld
the on model you can click the main part first then click on the second part you want to attach to the 1st part

here is a vid i cant paste it directly so need to upload to:

2 Likes

There is a simple yet effective way I would like to suggest, how would unions work? They take all parts and treat them as one.