local PP = game:GetService("PointsService")

function Connect(x)
 local Bonus,Type,mod = x.Amount.Value,x.Name,x.Parent
 local db = false
 x.Touched:connect(function(hit)
  if db then return end
  db = true
  local player = game.Players:getPlayerFromCharacter(hit.Parent)
	--local Bux = player.leaderstats.Bux
	--local Tix = player.leaderstats.Tix

  if player and player:findFirstChild("leaderstats") then
    player.leaderstats[Type].Value = player.leaderstats[Type].Value + Bonus;
	wait(.4)
    x:remove()
    wait(5)
    x.Parent = mod
	--[[if Type == Bux then
		local  decal=Instance.new("Decal",x)	
		decal.Texture = "rbxassetid://164000161"
		decal.Face = "Top"
	elseif Type == Tix then
		local  decal=Instance.new("Decal",x)	
		decal.Texture = "rbxassetid://33857200"
		decal.Face = "Top"
	end	]]
	end
  db = false
 end)
end

function Activate(x)
 for _,G in next,x:GetChildren()do
  if G:IsA("BasePart")and G:findFirstChild("Amount")then
   Connect(G)
  elseif G:IsA("Model")then
   Activate(G)
  end
 end
end

Activate(script.Parent)

1 comment

0

Cant help without explaination.