Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My hotel game laggs a lot, is there any script I can make to help with the lagg?

Asked by 4 years ago

Hi I built a Hotel and it really laggs like a LOT it's really slow could anyone help me with a script for it? I put a couple anti laggs from free models but it still laggs a lot :/

0
Don't use free models. "Anti-Lag" models only make it worse because it does the opposite of "Anti-Lag". Tyler090130 619 — 4y
0
And can add unwanted backdoor scripts. Geobloxia 251 — 4y
0
Okay thanks I will remove them. RadRosieee 8 — 4y

3 answers

Log in to vote
0
Answered by
ghxstlvty 133
4 years ago
Edited 4 years ago

This may be caused to do viruses in the game. If you search up "Vaccine" in the search on your explorer and scripts come up named Vaccine, delete them. These scripts are viruses and will cause lag. Next thing you could do it search "script" in the explorer and if any scripts come up that you know you didn't make and have random named, delete them.

Do not use anti-lag free models, these make the game worse.

0
Ecoszns is right. Also, to help find viruses/backdoor scripts use this Roblox plugin: https://web.roblox.com/library/2670956620/Hidden-Infection-Script-Detector Geobloxia 251 — 4y
0
Okay I will remove them, thank you so much for the help! RadRosieee 8 — 4y
Ad
Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago

Reduce the graphics quality or use this script:

mx = game.Debris
mx2 = game.Debris.MaxItems


if (mx.MaxItems > 9999999999) then
    mx.MaxItems = mx2* .9999999999
end
0
Might be deprecated though. Geobloxia 251 — 4y
0
^ You’re right about it being deprecated, but it’s also restricted and will error if used. I recommend you don’t use it: https://developer.roblox.com/en-us/api-reference/property/Debris/MaxItems User#20279 0 — 4y
0
Ok. Then just reduce the graphics quality. Geobloxia 251 — 4y
0
Okay. RadRosieee 8 — 4y
Log in to vote
0
Answered by
Dfzoz 489 Moderation Voter
4 years ago
Edited 4 years ago

There are various ways your game can lag, like excessive parts, script loops, viruses, etc.

If you are making a game that uses a lot of parts, you could try uniting them to make fewer parts, or setting workspace.StreamingEnabled to true. StreamingEnabled makes your game load parts only within a certain distance for the player. You have to take into account some objects that are not loaded wont be available for the player when using localscripts, and you will have to adapt them to this case.

if you have too many script loops, you can try increasing the wait time of such loop or changing some of them to events. For example, if you are checking if a player have a "Sword" tool inside their backpack, you could change the "while true do" to "player.Backpack.ChildAdded:Connect().

In case you are with a virus, which are commonly named like "Vaccine" or "yOuGotPwNedxsdsd", they can decrease performance a lot with the many loops they create.

To prevent this from happening, always insert freemodels while your not running the game and check if it has a script inside, even if it was just a mesh you wanted to use.

To remove them, you can use the following code. NOTICE that if you have game objects with similar name and classname as the virus, it WILL get destroyed, so create a backup for them before you run it. Add virus names and classnames you are dealing with on line 3 and 4.

--This script will search all items with a specific name and specific classname you set
local searchitems = {game.Workspace,game.Lighting} --Add directories to search
local targetname = {"Vaccine","Fire","Spread"} --Add scriptvirus names you are struggling with
local targetclassname = {"Script","Fire"} --Sometimes viruses replicate along with a different game object, like fire. Add them here.
local collected = {}
for i=1,#searchitems do
    local descendants = searchitems[i]:GetDescendants()
    for a=1,#descendants do
        local matchname = false
        local matchclassname = false
        for z=1,#targetname do
            if descendants[a].Name == targetname[z] then
                matchname = true
            end
        end
        for z=1,#targetclassname do
            if descendants[a].ClassName == targetclassname[z] then
                matchclassname = true
            end
        end
        if matchname == true and matchclassname == true then
            if descendants[a]:IsA("BaseScript") then--sometimes scripts have a way to reinsert themselves, so we need to disable them before that
                descendants[a].Disabled = true
            end
            table.insert(collected,1,descendants[a])
        end
    end
end
for i=1,#collected do
    collected[i]:Destroy()
end

Answer this question