How will I make this smoother so it doesn't look like it's lagging?

Hey, I have tweened this island using the tween service and it repeats infinite times with bool value reversing every time. Here’s what I have made:

Please suggest improvements/other techniques to do the same but smoothly.

3 Likes

I would say probably increase the time of the tween slightly more

Resetting? or you mean restarting?

Try using a local script in StarterGui, everyone will be at different positions but it’ll be less laggy. Only do this for visuals though.

Edit: What I mean by different positions is that everyone’s local script wont end or start at the same time, so when the platform is up it could be down for another player.

Example: (The gif looks laggy, but in-game it isn’t.)

image

while true do
	if workspace.Elevator.Size.Y < 21  then 
		workspace.Elevator.Size = Vector3.new(6, workspace.Elevator.Size.Y + .1,7) 
		workspace.Elevator.Position = Vector3.new(17,  workspace.Elevator.Position.Y + .1/2, 27.5)
	else	
		workspace.Elevator.Size = Vector3.new(6, 1, 7) 
		workspace.Elevator.Position = Vector3.new(17, -1.5, 27.5)	
		
	end	
	wait(.0001)	
end
2 Likes

@BxsicallyJacob I increased time in my code and I’d suggest you to tween size and position for the thing you’re doing. It’ll be easier.


Code I used:

local T = game:GetService('TweenService')
local Part = script.Parent
T:Create(Part, TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, true, 0), {Size = Vector3.new(4, 10, 2), Position = Part.Position*Vector3.new(1,10,1)}):Play()
--original size is 4,1,1
1 Like

Reset. Not restart. Resetting should fix it, I think…

hey, try this;

local StartPosition = Vector3.new(0,2.5,0)
local part = workspace.Part

while (true) do
        local time = tick()
        local sin = math.sin(time)
        part.Position = StartPosition + Vector3.new(0,sin,0)
        game:GetService("RunService").Heartbeat:Wait()
end

Result;

1 Like

Really clever and smooth too! Thanks Ill try it out.

1 Like

if I helped please mark as solution! :smiley:

It’s smoother after I used BodyGyro but due to some factors, I’ll continue with the earlier method. Thanks for your help and I’ll mark it as solution.

1 Like

I’d suggest playing tweens on the client but that would also get some potential problems as in exploiters can edit out but I guarantee it would be smooth (hopefully) oh and also only you get the effect and others wont see the tween animation synchronously
how to do it?
just copy paste the script and put in a local script inside starterplayerscripts

1 Like

I’d prefer keeping as less as possible on client. Prevents exploits :slight_smile: It’s smooth as for now but I may go with @varjoy’s method in future if issues arise.

1 Like