Vault code review

Prob cos your using roblox built in lerp, I dont get their lerp which is why I do it as my own function. Ill have a look on studio in 10mins and give you a hand if its still not going well. Going off memory atm

1 Like

ok had a look, you cant just lerp the whole cframe as is, its best done by breaking it down into its x,y,z for the angles.

1 Like

I have no idea what I am doing, I am doing this:

local Part = script.Parent
wait(3)
for i = 0, 1, 0.05 do
	Part.CFrame:Lerp(CFrame.Angles(0, math.rad(90), 0), i)
	print(i)
	wait()
end
local CFs = {}

CFs[1] = game.Workspace.DevForumP.CFrame

CFs[2] = CFs[1] * CFrame.Angles(0,math.rad(90),0)

CFs[3] = 0

while CFs[3] < 1 do

game.Workspace.DevForumP.CFrame = CFs[1]:Lerp(CFs[2],CFs[3])

CFs[3] = CFs[3] + 0.025

wait(0.025)

end

Just played around w robloxs built in cframe lerp this works, so basically roblox made it easier to lerp cfs,

a:lerp(b,c)
CF1:lerp(CF2,Completion)
entire CFs not just the angles

Why can’t I use the built-in lerp?

you arent using a whole CF, you have to use the whole cf not just the angles

God this is so hard for me to understand… Tweening is so much simpler.

probably true, it doesn’t really matter that much, its only the fact that you can pull every number off of a lerp as well as perform multiple lerps at the same time that makes it better.

1 Like

Are there any tutorials I can follow to understand it better?

This should help explain it, changed the link to the exact post that explains it simply

1 Like

Looks great!

In terms of improvements, you have an if/else block that run almost the same code.

Try putting that in a function and fiddling with parameters to knock out a few lines of code.

In terms of tweens, I typically run visual stuff such as tweens and interpolations on the client; running it on the server has the potential to cause choppiness, but in most cases the choppiness is negligible.

Overall, outstanding work!

1 Like

If I run it on the client, how will the whole server see the change? Using REs is technically loading it on the server anyway.

You can create the tween on the server, but I typically play the tween on the client, because in my experience, visual effects are kinda choppy on the server (which makes sense, latency is a thing).

You can do a thing where you like…

:FireAllClients(Tween)

if you’d like.

The choppiness on the tween is in most cases negligible though, so its really not that important.

1 Like

I feel like lerping is unnecessarily hard to learn and read. Tweenservice its easy on the eyes and can be tweened in different ways. Don’t get me wrong, lerping is amazing. But in this scenario, I think tweenservice is the right way to go.

2 Likes

I think your probably right, ive always used lerp instead of tween so im too used to lerping being the norm

2 Likes

Aaaahhh!!!
Please stop doing things like this. Just call it TweenService.

@minimic2002 @GamingExpert0312 This is a horrible idea. Please use TweenService, it exists for a reason. TweenService adapts to framerate and adjusts accordingly, whereas your script does not.

See TweenService:GetValue.

you can try using animations instead of tween service, I think they are about more or less the same as performance wise, also I think it’s much easier than tween service
just stick in an animator controller into the model, also an animator inside of the animator controller and rig the whole thing up using the rig editor plugin

—example code
local model = script.Parent
local controller = model.AnimatorController
local animator = controller.Animator

local animations = model.animations —folder to store animations

local open_animation = animations.OpenAnimation
local openAnim = animator:LoadAnimation(open_animation)

local function open()
openAnim:Play()
end
1 Like

Oh woah I didn’t think that was possible.

It’s completely up to his preference, maybe it’s easier for him because it shorter.

It’s not bad practice

1 Like