Fps drops when activating tool

after activating tool alot of times my game drops fps does anybody know how to fix this? i have a module that fires a remote event to gain currency and in every tool is a local script to check when the player activates the tool it will fire the module script. but over time of doing that it begins to drop over 20 fps when i activate it. does anybody have any ideas of why this is happening?

1 Like

Does the tool create unneeded parts?

no it does not it only fires the module script with a debounce time

can you send the code so I can see if your doing anything wrong?

this is the module script

this is the local script

maybe it has something to do with the code below, is there a lot of items inside of WeightIndex?

for i,v in pairs(WeightIndex) do
	if v.Name == item.Name then
		Module.Lift(item.Name, v.Gain)

yes it contains all the items in the game.

do you think i should create a number value in each tool and set the gain to that instead of getting it from the weightindex?

that is probably why, maybe put it into a table inside of the module script?


WeightIndex = {
	WeightName = 1,
	WeightName2 = 2,
	WeightName3 = 3,

i have just did that but how would i pass the gain through to the server script? since it needs to detect the tool the player has

Maybe you could put a IntValue inside of the tool and set the value of it to the weight gain. That way you can just look inside of the tool in both scripts.

1 Like

sorry for the late reply but that did help so thank you.