Make paramater name of event be in a equation

so i am trying to minize the codes i made, and i realized if i make the name of the block and the name of the leaderstat the same, i wouldn’t have to do it for every differant block, heres what i have:

Event.OnServerEvent:Connect(function(plr,target,pos,Block)
	if plr.Resources.Block.Value > 0 then

so i am trying to make the “block”(which is just a name) a thing in the equation, so how would i go about doing it?
(sorry if its hard to read ill try my best to explain it)

Do you mean something like this?

Event.OnServerEvent:Connect(function(plr,target,pos,Block)
	if plr.Resources[Block].Value > 0 then
2 Likes