Zipling works perfectly when testing in client but is very choppy on server. My ping is around 100m/s, I want this to be a good experience for everyone.
How can I fix this any ideas?
local pp = Instance.new("ProximityPrompt", script.Parent:WaitForChild("Start"))
pp.ActionText = "Press E to ride"
pp.ObjectText = "Ziplines"
local line = Instance.new("Beam", script.Parent.Start)
line.FaceCamera = true
line.Transparency = NumberSequence.new(0)
line.Width0 = 0.2
line.Width1 = 0.2
-- Set the color of the beam
line.Color = ColorSequence.new(Color3.new(0.333333, 0.333333, 0.333333)) -- Red color
local a0 = Instance.new("Attachment", script.Parent.Start)
local a1 = Instance.new("Attachment", script.Parent.End)
line.Attachment0 = a0
line.Attachment1 = a1
pp.Triggered:Connect(function(plr)
pp.Enabled = false
local hrp = plr.Character.HumanoidRootPart
local ziplineOffset = Vector3.new(0, hrp.Size.Y * 2, 0)
local distance = (script.Parent.Start.Position - script.Parent.End.Position).Magnitude
hrp.Anchored = true
hrp.CFrame = script.Parent.Start.CFrame - ziplineOffset
wait(0.2)
for i = 0, distance / 3 do
game:GetService("RunService").Heartbeat:Wait()
hrp.CFrame = hrp.CFrame:Lerp(script.Parent.End.CFrame - ziplineOffset, i / distance)
end
hrp.Anchored = false
pp.Enabled = true
end)