Hello there!
I’m working on a city rp game with a team.
But we’re having some issues, and one of them is in-game lag but no fps lost.
Some stuff wont move or will take a lot of time to load / work, but we don’t experience less fps.
Here’s an example:
The door is supposed to move in 1 second, but it takes 10-15 seconds. (The video shows fps lost but it’s because of my film maker. There’s no FPS lost in game)
The door is only an example of it, there are some other stuff with the same problem.
Is it because of replication? If the server is the one that opens the door, and you have a pretty low ping, then that may be why. Try to have the clients open the door and not the server for a much faster and smoother effect. Use RemoteEvents if necessary.
There is no such thing as an anti lag script, but it would be pretty cool if there were. As it stands, anything that actually makes a noticeable difference needs to be handled on a case-by-case basis.
That said, can you show me the script that handles the door? Even if it’s handled by the server, it should not be that bad.
Well this is the script.
local TimeAfterClose = 3
local Hinge = script.Parent.PrimaryPart
local opened = false
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrameCFrame.Angles(0, math.rad(5), 0))
wait()
end
wait(TimeAfterClose)
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrameCFrame.Angles(0, math.rad(-5), 0))
wait()
end
opened = false
end
end
Replace wait() with game.RunService.RenderStepped:wait() and I think you should be good. The script is not well written in general, so this is not a good permanent solution, but I think it should fix the issue.
Looking at this script; you are using a for i loop but not actually using i, you are just setting the angle to 5* 21 times for no reason with a wait, so each loop is taking 21*0.03 seconds to finish
There is no issue with game lag the script just isnt working.