I want suggestions about how to eliminate or improve the performance of this script.
In Studio, the part and the script work fine. The player and the part move up and down as expected. If I open the game on Roblox on my MacBook, the part is a little jittery, but it does the job. When I run the project on my iPadPro, when the player jumps on the part, it will get very jittery, and most times CanCollide fails, and the player falls through.
The elevator part is anchored, so I can’t use network ownership. I have four elevators, and I converted them all to run off one tagged script; however, it made no difference. I suspect it may be a network performance or processing issue with my devices, but I’m not sure.
Any help or suggestions would be appreciated. Cheers 
local part = script.Parent
local startPosition = part.Position
local amplitude = 11 -- how far the part moves up and down
local frequency = 1 -- how fast the part moves
while true do
-- Calculate the new Y position based on time
local newY = startPosition.Y + math.sin(time() * frequency) * amplitude
-- Update the part position
part.Position = Vector3.new(startPosition.X, newY, startPosition.Z)
-- Wait a short time before updating again
wait(.001)
end
