Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Drop script causing wayyy to much lag?

when this script runs to drog an item it creates lag, the first time not so much but reapeating it makes it lag alot and ends up crashing. anyone know why?

local drop = script.Parent
drop.MouseButton1Click:connect(function()
	
	
	
	local item = _G. globalslot
	local itemobj = item.SlotImage.ItemName.Value
	local clone = game.ReplicatedStorage.WorldItemDrops:FindFirstChild(itemobj):Clone()
	clone.Parent = game.Workspace
	
	item.SlotImage.Image = ""
	item.SlotImage.SlotAmount.Text =""
	item.SlotImage.ItemName.Value = ""
	drop.Parent.Visible = false
	

	
end)

4 comments

0

testing its script preformance, it rises everytime i use the function

0

for some reason its the putting the clone in workspace that causes it to lag, but this increases the more i run it

0

How big is the thing you're trying to clone?

0

about 2X.5X5

1 answer

I see no wait() or a debounce.

1 comment

1

i dont think it needs a wait since it runs only when someone clicks the button, and the button only appears when a gui is made visible when certain requierments are met so i dont think i neeed a debounce either. i think it might be the global variable

This discussion is preserved as it was. New answers, comments, and votes are closed.