I have multiple blocks named the same thing inside a folder, and instead of putting a script into each block I want to put a script into serverscriptservice that does what the script in the block would do.
The folder is located here: model = game.Workspace.Storage.Bits
I want to add 1 Money to the players leaderstat whenever they touch the "bit". This is what I have:
--Put all the parts in a model
money = player.leaderstats.Money.Value -- locates money
model = game.Workspace.Storage.Bits
DownTime = 3.5 --the time the parts are gone
function bit(part)
model.bit:remove()
end
for i,v in pairs(model:GetChildren()) do
v.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
money = money + 1 -- adding the money here
bit(v)
end
end)
end
