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

How do i make maths in position of vector3.new?

Asked by 4 years ago

I want to make animated part that starts while loop and makes part move in X axis, and stops the part when its in position i want it to be, something like this

(code below is an example)

1local blah = game.workspace.blah
2blah.Touched:Connect(function()
3while true do
4blah.position = vector3.new(0,0,0) + 1 -- in x axis only
5if blah.position == vector3.new(100,0,0) then
6stop loop and dont let the part move
7end

Sorry for my english

0
welp, i think im not going to get anserwed Dawnymurzyn 7 — 4y
0
Try tweenservice or maybe use CFrame :) could work. xsodar 19 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hi, dunno if you'll see this but it seems you want a tween. If you don't know what a tween is, then i recommend to look here. Now, lets work coding on it.

01-- Services --
02local twService = game:GetService("TweenService")
03 
04-- Variables --
05local blah = script.Parent
06 
07local info = TweenInfo.new(
08    10, -- How long it should play.
09    Enum.EasingStyle.Linear, -- How it should move.
10    Enum.EasingDirection.In, -- Direction of how to tween.
11    0, -- Re-Playing it, 0 means no re-playing.
12    false, -- Should it do back to it's original position? For this no.
13    0 -- How long will the script wait until executing the info.
14)
15 
View all 28 lines...

Hopefully I could help you. If it doesn't work like you wanted, you can tell me. Possibly I can help you, g'day.

Ad

Answer this question