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

can someone help me with a Lag issue?

Asked by 9 years ago

OK, I am making a Tycoon and it is working great right now.

When I get into the tycoon about half way through the conveyor belts start to mess up

They start to slow down and pause some, like Lag...

It cause the blocks to pile up...

Now to stop this from happening I changed the drop time to increase the time between drops, just increased the cash of the drops

but no matter what I change the time to it still does the same thing.

How can I fix that problem?

all the code that I have works fine...

just normal drop code as well as normal belt code.. Nothing special.

Dropper code

wait(2)
while true do
    wait(2.5)
    local part = Instance.new("Part",workspace)
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 20
    part.CFrame = script.Parent.Drop.CFrame
    part.Size=Vector3.new(1,1,1)
    local nMesh = Instance.new("SpecialMesh", part) 
    nMesh.MeshType = "FileMesh" 
    nMesh.MeshId = "http://www.roblox.com/asset/?id=19059116" 
    nMesh.TextureId = "http://www.roblox.com/asset/?id=19059111"
    a = part
    game.Debris:AddItem(part,60)
end
if a ~= nil then
    wait(5)
    a:Destroy()
end

belt code

while 2 > 1 do
    script.Parent.Velocity = script.Parent.CFrame.lookVector*15
    wait(0.2)
end

any help would be great.... thanks!

0
Make sure you dont have any 'Viruses' in your game. These can be in any free model you put into your place and they slow down the game a lot. Teeter11 281 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Well, your code is fine, but as BestDeveloper said, it could be due to some viruses. Check in your game. See if there are any unnecessary scripts, that could possible create "Fire" or ReplicatedStorage. If you have any Free Models within your place, be sure to check those thoroughly. Here's a script that I made, to go through everything in Workspace, to make sure there is no "Fire". :

-- By Shawnyg

local count = 0

function ClearFire(v)
    for i,v in pairs(v:GetChildren()) do
        if not v:IsA("Model") and not v:IsA("Fire") then
            if v:findFirstChild("Fire") then
                v.Fire:Destroy()
                count = count+1
            end
        elseif v:IsA("Model") then
            ClearFire(v)
        elseif v.Name == "Fire" then
            v:Destroy()
            count = count+1
        end
    end
end

for i,v in pairs(game.Workspace:GetChildren()) do
    ClearFire(v)
end
print('This script has removed '..count..' fires!')
0
what does this mean? when in a part Wedge-to-Part Strong Joint snipers0076 5 — 9y
0
do the parts really need the chain like item inside them that states this some times (Wedge-to-Part Strong Joint) snipers0076 5 — 9y
0
the chain like items say other stuff as well.. snipers0076 5 — 9y
0
As well thanks alot for the help snipers0076 5 — 9y
Ad

Answer this question