Wait, why do we need all the clients to see it?
Do you want to make a game where only one player can play?
I’m assuming that because you used a lerp on the server, therefore you want it to be global no? If you only tween on that client, the other clients won’t see the tween and therefore the part just stay there
I tried doing it in a local script and the activity rate was 0.7%, is it suppose to be that high?
It’s not. Try reinstalling Roblox Studio or try a different way.
I did try reinstalling it and I tried checking it again, the activity rate went up to 0.9%. In a local script.
Okay, after some testing my lerps averages out at 0.7% as well. Meanwhile when I use TweenService it takes up an amazing… 0%. It’d appear that it is better to use TweenService as opposed to Lerping.
If you use lerp for those camera stuffs (like probably cutscenes), won’t it ruin your game? and how does the bezier curve work that you mentioned before?
Well, I’ve not really used lerping much, I’ve always sticked to TweenService so it’s a surprise to me that lerping takes that much resources. And I don’t think 0.7% is significant enough to break your game unless you spam lerp everywhere.
A bezier curve is like a Lerp inside a Lerp. You can check out more on the first few chapters of this video
Is it useful for games? And like we can use TweenService to do that?
Bezier curves are very useful for games yes. Unfortunately, it’s not possible to use TweenService to tween through bezier curve, you have to use Lerp and possibly some algorithms to optimize it more. If you search for it, there’re probably many devs that have open-sourced an optimized module to manipulate curves so you don’t really have to worry about them.
Ok, so for the RunService. I have this chase script, the activity rate goes up to 0.1%, 0.3%, 0.7%, and sometimes 0.9%. It goes down too sometimes. I’m sure that’s fine, because like it has to constantly chase the player.
But will it be a problem if there were a lot of them? Like because you wanted to have a lot of mobs. If so, is there a way to optimize it?
I used RunService instead of loops because people said it’s better.
local humanoid = script.Parent:WaitForChild("Zombie")
local MLH_gaming = workspace:WaitForChild("MLH_gaming")
local hrp = MLH_gaming:WaitForChild("HumanoidRootPart")
game:GetService("RunService").Heartbeat:Connect(function()
humanoid:MoveTo(hrp.Position, hrp)
end)
However I tried using a while loop instead of RunService, the activity only went up to 0.1%. Now that’s a huge difference.
local humanoid = script.Parent:WaitForChild("Zombie")
local MLH_gaming = workspace:WaitForChild("MLH_gaming")
local hrp = MLH_gaming:WaitForChild("HumanoidRootPart")
while true do
task.wait(0.1)
humanoid:MoveTo(hrp.Position, hrp)
end
If that’s the case don’t use RunService, use a while true loop with some delays to it, as you don’t have to update the player’s position every frame.
Alternatively, you can use PathfindingService
RunService should not be used infinitely? Like because it fires every frame.
Depending on what you’re doing inside the loop. If you compute something very expensive, then it’s best to minimize the usage of RunService, otherwise it’s nothing at all
My bad, it was my vagueness. I normally use heartbeat on the server, and renderstepped exclusively on the client. There are very few circumstances where I use heartbeat on the client so my bad entirely.
RunService runs every frame, so if the client runs at 60fps, it will run 60 times per second while task.wait(0.1) will run only 10 times per second. What I have noticed working with CFrames (and also positions) is that changing the CFrame of a part causes a lot more lag than I expected. For the best performance, if you have a model, weld all the parts togheter and only leave 1 part anchored. Don’t use PivotTo()/MoveTo() on the whole model, either call PivotTo()/MoveTo() on the anchored part of the model or change the CFrame of the anchored part directly (changing the position wont make welded parts move with it).
TweenService does cause lower activity in the performance tab, but looking at the micro profiler, I noticed that the work done by tween service is simply not included in the performance tab. I do not now if tween service is actually faster or not.
Using physics is probably not better either
If you use special meshes and move them using the offset property, they are extremly cheap to run, however, they cannot be rotated. You could use the offset property to move them linearly and rotate the parent when you need to rotate them
Did not test using animation or bones, I actually know very little about animating
What’s the difference between the two? And can just I anchor the primary part of the model and move it?
offset is basically just to move right?