this is the script:

local id = 17088519

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
	if purchased and ido == id then
		local InstanceThatContainsMyParts = workspace.FolderContainingParts

		for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
			if v:IsA("BasePart") then
				v.Material = Enum.Material.SmoothPlastic
			end
		end
	end
end)

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
			local InstanceThatContainsMyParts = workspace.FolderContainingParts

			for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
				if v:IsA("BasePart") then
					v.Material = Enum.Material.SmoothPlastic
				end
			end
		end
	end)
end)

1 comment

0

I guess the problem in it is something related to looping...