#Can someone help me with this?

1 messages · Page 1 of 1 (latest)

zinc sigil
wintry trench
#

so do you want this to happen on a click? or when a certain event happens

#

do you want it to bounce up and down all the time?

#

how do you want this to happen

zinc sigil
wintry trench
#

okay sure

#

do you want me to help you learn?

#

or just send u it

zinc sigil
#

Sure, you can help me learn it

#

It's better

wintry trench
#

okay first you need a script inside your part right

zinc sigil
#

Yeah

wintry trench
#

so make a while true loop

zinc sigil
#

how?

wintry trench
#

this means that it will always run

#

as true is always true right

zinc sigil
#

yeah

#

So its basically like scratch but you gotta write it by yourself

wintry trench
#

okay so do you have any coding knowleadge btw

wintry trench
twin egretBOT
#

studio** You are now Level 9! **studio

wintry trench
#

and write it

zinc sigil
#

I do got coding knowledge but in scratch

#

And scratch isn't lua

#

if i'm right

wintry trench
#

yeah

zinc sigil
#

So basically no

wintry trench
#

okay well now we want to make the animation

#

so we use tweening

#

so first outside of your while loop

#

define TweenService

#

so local TweenService = game:GetService("TweenService")

#

this just makes our code more readable

#

otherwise we could just use game:GetService("TweenService") instead

zinc sigil
wintry trench
#

outside

zinc sigil
wintry trench
#

yeah normally you put it at the top

#

you have to

#

because the loop doesnt end

#

meaning it wont go to the code below

zinc sigil
wintry trench
#

yes

#

okay so now

#

we make the animation

#

so first make a varible

#

and name it anything

#

it will be used to store the current animation

zinc sigil
#

Okay

#

a variable..

#

how do I create a variable

wintry trench
#

well we created one above

#

ignore the stuff after the = as thats when we define it

#

the local means to create a varible

zinc sigil
#

where do I set the variable

wintry trench
#

and after the local will be the name of your varible

  • The name can NOT include a space
wintry trench
#

with a tab

zinc sigil
#

Okay I created the variable

wintry trench
#

show

#

name it

#

so after local call it something

#

we will use it to animate our part

#

so ideally something to do with that so you understand later

zinc sigil
#

I'm gonna change cube

#

a second

#

Changed it to Diamond

wintry trench
#

okay good

#

so now we want to create our animation

zinc sigil
#

Okazy

wintry trench
#

so do local Cube = TweenService

zinc sigil
#

I re named it to Diamond

#

Done

wintry trench
#

show

zinc sigil
wintry trench
#

okay

#

so now

#

we want to create our animation

#

so we do TweenService:Create()

zinc sigil
#

yeah.

wintry trench
#

and now

#

inside the brackets

#

you want to use your part

#

so script.Parent

zinc sigil
#

Done

wintry trench
#

then use a ","

#

then we need to define what type of animation we do

zinc sigil
wintry trench
#

so we use TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

wintry trench
#

(script.Parent, )

zinc sigil
zinc sigil
wintry trench
#

so the first thing in the brackets is how long we want it to go up for

#

so right now its 1 second

#

feel free to change

zinc sigil
#

1 second what?

#

Will it go up and down on seond

wintry trench
wintry trench
#

we will add down in a sec

zinc sigil
#

It will only loop for one second

#

If i'm right?

wintry trench
#

not loop

#

like the time it takes to go upwards wil ltake 1 second

zinc sigil
#

Ohh

wintry trench
#

yes

zinc sigil
#

1 second seems good

#

Or no

#

2.5 seconds

#

Okay done

#

what now?

wintry trench
#

okay so now we need to define how far to move

zinc sigil
#

mhm.

#

how?

wintry trench
#

we have to add another ,

#

then we use CFrame to change it

zinc sigil
#

add another .??

wintry trench
#

{CFrame = script.Parent.CFrame + Vector3.new(0, 10, 0)}

wintry trench
zinc sigil
#

okay

#

where do I place it

wintry trench
#

after the last bracket

#

add a ,

zinc sigil
#

here?.

wintry trench
#

yes

zinc sigil
#

like there?

wintry trench
#

just so we know you can do it like this so its a lot easier to read

local TweenService = game:GetService("TweenService")
local diamond = script.Parent

local buttonTweenInfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.InOut,
    -1,
    true
)

while true do
    local targetPosition = diamond.CFrame + Vector3.new(0, 10, 0)
    local tweenButton = TweenService:Create(diamond, buttonTweenInfo, {CFrame = targetPosition})

    tweenButton:Play()
    tweenButton.Completed:Wait()
end```
zinc sigil
#

Should I copy and paste it

#

its better

wintry trench
#

Yeah sure

#

The rest is easy to understand

zinc sigil
wintry trench
#

Now run it

zinc sigil
#

doesn't work

#

it doesnt go up or down

wintry trench
#

Check the output

zinc sigil
wintry trench
#

Oh that’s why

zinc sigil
wintry trench
#

Okay

#

So the best way is to make both them pyramids

#

A union together

#

Then put the script inside

#

Because you dna put the script inside one of the pyramids now and it will sort of work

zinc sigil
#

I done it

wintry trench
#

It works?

zinc sigil
#

nope

wintry trench
#

Show output

zinc sigil
#

is it because of this

wintry trench
#

No

zinc sigil
wintry trench
#

Okay well first you need to put the script inside the union

#

It’s currently in the model

zinc sigil
#

it works

#

Thanks A LOT

wintry trench
#

No problem

#

Mess around with it

#

Change time

#

e.g