So I have a tool, that fires an event which then changes your stats etc. It works fine, but when i clone it, it breaks, and i cannot localize it's handle. It fires an event like this :

tool.Equipped:Connect(function()
strength:FireServer(handle, 1)
end

And a script in Serverscriptservice does this :

remoteEvent.OnServerEvent:Connect(function(plr, handle, amount)

		wait()
				
		local emp = handle:FindFirstChild("Multiplyer").Value
		
		local lpoints = "Energy"
		plr.leaderstats[lpoints].Value = plr.leaderstats[lpoints].Value+emp
end

The tool's handle has an IntValue with a number in it and when you click it, it increases your "Energy" by the said number. As i said, the tool works just fine, but when i clone it (i have a shop gui) it doesnt. I get this error :

ServerScriptService.StatsHandler:62: attempt to index nil with 'FindFirstChild' I tried doing

print(handle.parent)

and found out that it simply doesnt know where the handle is.

2 comments

0

I don't quite understand

0

The tool's handle has an IntValue. The tool fires an event, and when that event is fired, a script will check the value in the IntValue, and then it adds that number to my leaderstats.