I’ve been reading some posts relating to this issue and some have suggested replicating the Tweening on the client. However, the jitteriness is still occurring but it’s a bit more subtle, but this won’t do much good when the elevator moves at high speeds.
Tweening on the Serverside:
Client:
What can I do to keep the player on the platform stably?
I think the best thing to do is have an invisible base object (elevator moves with, the tweened part). When the player is lets say, 400 studs away from the Base. It spawns the Elevator Model in and syncs positions with the Base using RenderStepped.
You can also Attach yourself and others to the floor on the client in the same RenderStepped.
I’d look in to this
My main concern about using physics is that I believe they can be vulnerable to exploits (correct me if I’m wrong), and are you able to tween prismaticconstraints? I have no experience with them.
You are able to tween prismatic constraint properties, not the movement itself. Server-sided anti cheats (such as repeatedly setting the constraint speed to, say, 10 and then 10.1 and then back to 10) could help prevent those. I haven’t had issues with it
One way you can protect the elevator from tampering is by setting the network ownership of its primary part to nil (you’ll have to do so using a server script). This will make the server handle the physics calculations for your elevator, so exploiters won’t be able to move it to wherever they please, but it does come with the drawback of adding more work for the server to do, especially if the server is already busy calculating the physics of other assemblies. It’s also not as smooth as allowing the client to calculate the physics themselves, but the result is good if network conditions are ok
I have one doing this same thing. I modified a model and got it working pretty smooth. Still need to add this to my other one… Lift.rbxm (18.6 KB) ← click to download.
@D7L14 For a more realistic effect that isn’t over complicated, this.
Ensure NetworkOwnership is set correctly and just be warned for bugs in constraints when the server FPS drops under 24 (Rare, but can happen to Roblox’s Servers)
Thanks for the advice everyone, I discovered this script and it COMPLETELY resolved the issue, it’s buttery smooth. Here it is.
local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local lastPlatform = nil
local lastPlatformCFrame
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = { player.Character or player.CharacterAdded:Wait() }
local part = workspace:WaitForChild("Platform")
local defCFrame = part.CFrame
runService:BindToRenderStep( "Test", 1, function()
task.defer(function()
local raycastOffset = CFrame.identity
if ( lastPlatform ) then
raycastOffset = lastPlatform.CFrame * lastPlatformCFrame:Inverse()
end
local hrp = player.Character.PrimaryPart
if ( not hrp ) then return end
local results = workspace:Raycast( hrp.Position + raycastOffset.Position, Vector3.new( 0, -50, 0 ), params )
if ( results and results.Instance and results.Instance.Name == "Platform" ) then
if ( lastPlatform ~= results.Instance ) then
lastPlatformCFrame = results.Instance.CFrame
end
lastPlatform = results.Instance
local offset = lastPlatform.CFrame * lastPlatformCFrame:Inverse()
lastPlatformCFrame = lastPlatform.CFrame
hrp.CFrame = offset * hrp.CFrame
camera.CFrame = offset * camera.CFrame
else
lastPlatform = nil
end
end)
end)