Hi there, I’ve currently got cars spawning every second, with about 20ish cars in the game at a time. Currently they are all controlled by the TweenService handler I’ve made. I’m encountering an issue where mobile performance goes down a lot with the cars enabled ingame. When the cars are turned off, they have no issues.
local function moveCar(newCar, endPoint)
local tweenserivce = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
9.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = newCar:GetPrimaryPartCFrame()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
newCar:SetPrimaryPartCFrame(CFrameValue.value)
end)
local tween = tweenserivce:Create(CFrameValue, tweeninfo, {Value = endPoint.CFrame})
tween:Play()
end
Here’s a short clip:
Would having the models welded together, and using a MoveTo function cause better performance for the client?
Infact, most likely they would probably go up. If performance is really an issue you should run the tweens on the clients and have a setting for the clients to pause it.
Yeah, I’ve noticed an increase in performance since I switched the animation of the cars to the client side. Just need to figure out how I’m going to handle the rest on the server side. Thank you!
You shouldn’t use :SetPrimaryPartCFrame(), this function has been ‘deprecated’. You should use :PivotTo(). The reason is because :SetPrimaryPartCFrame() has float point errors once you use it a certain degree.
Regardless of where the object is, :SetPrimaryPartCFrame() will always have float point problems. You might be getting confused with the nil/null zone after ~10,000 studs.