Script lag. Help!

Okay. So I’m following a tutorial a scripting tutorial. And I’ve recently encountered a issue. Every time I edit the script everything goes grey and I lag. Alot. Is this a bug do I have a virus? (Although I’d doubt it because this is a new baseplate. I’ve tried changing places/games etc) Or is this a technical bug. Please help! :thinking:

1 Like

Make sure there aren’t any loops that look like this in your scripts:

while true do
end

Loops like that can cause a lot of lag.

I will try that now! Fingers crossed.

Don’t think there are any. Heoriginalscript re’s the original script

Why do you need to put a spawn function? Maybe the spawn function is causing the lag.

i see that you used Phantom’s tutorial, his videos are alright but the scripts can sometimes be weird.

I reccomend watching @Alvin_Blox 's tutorial on how to make admin commands.

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg,r)
		if table.find(Admins,plr.Name) then
			local Args = msg:split(" ")			
			local cmd = Args[1]:split("/")			
			if require(Commands)[cmd[2]] then
				local arguments = {}		
				for i = 2,#Args,1 do
					table.insert(arguments,Args[i])
				end		
				require(Commands)[cmd[2]](plr,arguments)
			end
		end		
	end)
end)

Alright. Will try. :slightly_smiling_face:

Can you show us what is inside of your modulescript?

It is due to a plugin. I deleted some plugins that I don’t need. Found out I had over 30 plugins. And all activated at once.

1 Like