#Can someone help me with this?
1 messages · Page 1 of 1 (latest)
You need to use tween service
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
No I want it to be like this but then it goes up and down the whole time non stop.
okay first you need a script inside your part right
Yeah
so make a while true loop
how?
while true do
code will go here
end```
this means that it will always run
as true is always true right
okay so do you have any coding knowleadge btw
yeah but you have to know the blocks
** You are now Level 9! **
and write it
yeah
So basically no
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
outside
yeah normally you put it at the top
you have to
because the loop doesnt end
meaning it wont go to the code below
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
well we created one above
ignore the stuff after the = as thats when we define it
the local means to create a varible
where do I set the variable
and after the local will be the name of your varible
- The name can NOT include a space
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
Okazy
so do local Cube = TweenService
show
yeah.
Done
so we use TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
then add this
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
then the second bit is our style, on this website you can see how they move
https://create.roblox.com/docs/reference/engine/enums/EasingStyle
Ohh
yes
okay so now we need to define how far to move
add another .??
{CFrame = script.Parent.CFrame + Vector3.new(0, 10, 0)}
yes
yes
like there?
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```
Now run it
Check the output
Oh that’s why
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
I done it
It works?
nope
Show output
is it because of this
No